This works around a warning from std::vector code, which seems to be
assuming that the vector is empty and therefore calling back() would be
invalid:
/home/test/src/gcc/gcc/cobol/symfind.cc:526:45: error: array subscript -1 is outside array bounds of ‘long unsigned int [
1152921504606846975]’ [-Werror=array-bounds=]
526 | return ancestors.back() == i01;
| ~~~~~~~~~~~~~~~~~^~~~~~
Compiling with -D_GLIBCXX_ASSERTIONS also fixes the warning.
gcc/cobol/ChangeLog:
PR cobol/125404
* symfind.cc (symbol_find): Add assertion that ancestors vector
is not empty.
std::inserter(qualified, qualified.begin()),
[i01]( auto item ) {
const std::vector<size_t>& ancestors(item.second);
+ assert(!ancestors.empty());
return ancestors.back() == i01;
} );
items = qualified;