srsRAN_4G icon indicating copy to clipboard operation
srsRAN_4G copied to clipboard

various array subscript bounds warnings on Fedora 39

Open jgiovatto opened this issue 1 year ago • 0 comments

Hi Folks

Compiling on Fedora 39 gcc version 13.2.1 20240316 (Red Hat 13.2.1-7) (GCC)

srsue/src/phy/phy_common.cc:934:21: /usr/include/c++/13/array:203:24: error: array subscript 5 is above array bounds of ‘std::__array_traits<float, 5>::_Type’ {aka ‘float [5]’} [-Werror=array-bounds=]

I'd suggest the following:

  • if(cc_idx <= SRSRAN_MAX_CARRIERS)
  • {
  • // Default all metrics to NAN to prevent providing invalid information on traces and other layers
    
  • std::unique_lock<std::mutex> lock(meas_mutex);
    
  • pathloss[cc_idx]       = NAN;
    
  • avg_rsrp[cc_idx]       = NAN;
    
  • avg_rsrp_dbm[cc_idx]   = NAN;
    
  • avg_rsrq_db[cc_idx]    = NAN;
    
  • avg_rssi_dbm[cc_idx]   = NAN;
    
  • avg_cfo_hz[cc_idx]     = NAN;
    
  • avg_sinr_db[cc_idx]    = NAN;
    
  • avg_snr_db[cc_idx]     = NAN;
    
  • avg_noise[cc_idx]      = NAN;
    
  • avg_rsrp_neigh[cc_idx] = NAN;
    
  • }

Im not sure what to do with these ...

lib/test/asn1/srsran_asn1_rrc_meas_test.cc:183:42: /usr/include/c++/13/bits/stl_algobase.h:437:30: error: ‘void* __builtin_memmove(void*, const void*, long unsigned int)’ forming offset 3 is out of the bounds [0, 3] [-Werror=array-bounds=]

lib/test/asn1/srsran_asn1_rrc_meas_test.cc:194:57: /usr/include/c++/13/bits/stl_algobase.h:437:30: error: ‘void* __builtin_memmove(void*, const void*, long unsigned int)’ forming offset 36 is out of the bounds [0, 36] [-Werror=array-bounds=]

ib/test/asn1/rrc_nr_utils_test.cc:809:76: /usr/include/c++/13/bits/stl_algobase.h:437:30: error: ‘void* __builtin_memmove(void*, const void*, long unsigned int)’ forming offset 16 is out of the bounds [0, 16] [-Werror=array-bounds=]

jgiovatto avatar May 28 '24 16:05 jgiovatto