https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125404

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <[email protected]>:

https://gcc.gnu.org/g:8b4ed6bbfb9fd4029a78265088e24b7500f33037

commit r17-906-g8b4ed6bbfb9fd4029a78265088e24b7500f33037
Author: Jonathan Wakely <[email protected]>
Date:   Wed May 20 22:24:33 2026 +0100

    cobol: Add assertion to suppress -Warray-bounds false positive [PR125404]

    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.

Reply via email to