Skip to content

Conversation

@edigiacomo
Copy link

When _GLIBCXX_ASSERTIONS is set (see https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_macros.html), Magics sometimes throws a runtime error:

/usr/include/c++/12/bits/stl_vector.h:1123: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = double; _Alloc = std::allocator<double>; reference = double&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.

The runtime error are raised when some instance methods are invoked on an empty vector, e.g. operator[] or front(). This PR tries to fix some of these potential errors, resizing the vector before populating it or using insert instead of operator[].

See https://jira.ecmwf.int/plugins/servlet/desk/portal/4/SD-80581 for more details.

@FussyDuck
Copy link

FussyDuck commented Jun 22, 2023

CLA assistant check
All committers have signed the CLA.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants