The call to std::remove_if used here doesn't remove any elements, it just overwrites the "removed" elements with later elements, leaving the total number of elements unchanged. Use std::list::remove_if to actually remove those unwanted elements from the list.
gcc/cobol/ChangeLog: * symfind.cc (finalize_symbol_map2): Use std::list::remove_if instead of std::remove_if. --- gcc/cobol/symfind.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gcc/cobol/symfind.cc b/gcc/cobol/symfind.cc index 38a890006c8..b397aa56d41 100644 --- a/gcc/cobol/symfind.cc +++ b/gcc/cobol/symfind.cc @@ -125,11 +125,10 @@ finalize_symbol_map2() { for( auto& elem : symbol_map2 ) { auto& fields( elem.second ); - std::remove_if( fields.begin(), fields.end(), - []( auto isym ) { - auto f = cbl_field_of(symbol_at(isym)); - return f->type == FldInvalid; - } ); + fields.remove_if( []( auto isym ) { + auto f = cbl_field_of(symbol_at(isym)); + return f->type == FldInvalid; + } ); if( fields.empty() ) empties.insert(elem.first); } -- 2.48.1