https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85651
--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> --- I'm afraid the pragma problem is an independent bug that affects many/most middle-end warnings (see, for example, the test case below). It will require a different and likely more involved change. $ cat u.c && gcc -O2 -S -Wall u.c int f (int i) { return "123"[i]; } int g (void) { #pragma GCC diagnostic ignored "-Warray-bounds" return f (4); } u.c: In function ‘g’: u.c:3:15: warning: array subscript 4 is above array bounds of ‘char[4]’ [-Warray-bounds] return "123"[i]; ~~~~~^~~