https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119576
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Arthur O'Dwyer from comment #6) > 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" r12-2178-g79d3378c7d7381 (PR 101372) looks to hack around maybe undefineness that was not "fixed" > 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) r7-5713-ge1d070a4f7128f added it. So 8 years ago. This might already be fixed too but nobody has tried to remove it. > libgcc/config/pa/fptr.c:#pragma GCC diagnostic ignored "-Warray-bounds" pa/fptr messes around with function pointers (because PA needs some special handling for comparing function pointers). This is undefined for user to do. This is one place where using this pragma and turning off warnings is correct but users of GCC should get that warning. > libstdc++-v3/include/bits/char_traits.h:#pragma GCC diagnostic ignored > "-Warray-bounds" Done by r12-5874-gf8463b0e3ec243 (I think the underlying issue was fixed but the #pragma was never removed). > 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" These are used when the input are undefined ... Or at least that is what the comment says.