sst-core
sst-core copied to clipboard
Missing error handling in SparseVectorMap
With GCC 15.2.0, possible indexing with -1 is being detected by the compiler:
In file included from /home/ejberqu/development/forks/sst/sst-core/src/sst/core/configGraph.h:20,
from /home/ejberqu/development/forks/sst/sst-core/src/sst/core/simulation.cc:20:
In member function 'classT* SST::SparseVectorMap<keyT, classT*>::operator[](keyT) [with keyT = long unsigned int; classT = SST::ConfigComponent]',
inlined from 'void SST::Simulation_impl::processGraphInfo(SST::ConfigGraph&, const SST::RankInfo&, SST::SimTime_t)' at /home/ejberqu/development/forks/sst/sst-core/src/sst/core/simulation.cc:526:67:
/home/ejberqu/development/forks/sst/sst-core/src/sst/core/sparseVectorMap.h:508:26: warning: array subscript -1 is outside array bounds of 'SST::ConfigComponent* [1152921504606846975]' [-Warray-bounds=]
508 | return data[index];
| ^
caused by https://github.com/sstsimulator/sst-core/blob/29e833899e55acc37e54103ee6e418714ca3f817/src/sst/core/sparseVectorMap.h#L501-L508 where the "need to error out" occurs in a few places.
Should these throw std::runtime_error?