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

--- Comment #6 from Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> ---
Will Wray points out that GCC's own codebase disables `-Warray-bounds` in
several places, including at least these places in current master:

gcc/cp/module.cc:#pragma GCC diagnostic ignored "-Warray-bounds"
gcc/fortran/simplify.cc:              GCC_DIAGNOSTIC_PUSH_IGNORED
(-Warray-bounds)
gcc/fortran/simplify.cc:              GCC_DIAGNOSTIC_PUSH_IGNORED
(-Warray-bounds)
gcc/fortran/simplify.cc:              GCC_DIAGNOSTIC_PUSH_IGNORED
(-Warray-bounds)
libgcc/config/pa/fptr.c:#pragma GCC diagnostic ignored "-Warray-bounds"
libstdc++-v3/include/bits/char_traits.h:#pragma GCC diagnostic ignored
"-Warray-bounds"
libstdc++-v3/include/experimental/bits/simd_fixed_size.h:#pragma GCC diagnostic
ignored "-Warray-bounds"
libstdc++-v3/include/experimental/bits/simd_fixed_size.h:#pragma GCC diagnostic
ignored "-Warray-bounds"

For example, the first hit in "gcc/fortran/simplify.cc":

          if (n < result->rank)
            {
              /* If the nested loop is unrolled GFC_MAX_DIMENSIONS
                 times, we'd warn for the last iteration, because the
                 array index will have already been incremented to the
                 array sizes, and we can't tell that this must make
                 the test against result->rank false, because ranks
                 must not exceed GFC_MAX_DIMENSIONS.  */
              GCC_DIAGNOSTIC_PUSH_IGNORED (-Warray-bounds)
              count[n]++;
              base += sstride[n];
              dest += dstride[n];
              GCC_DIAGNOSTIC_POP
            }

Reply via email to