rh1948567-1.c: void foo (char x[2]); int main () { char x[2]; #pragma GCC diagnostic ignored "-Wstringop-overflow" foo (x + 1); } rh1948567-2.c: void foo (char x[2]) { asm volatile ("" : : "r" (&x[0]) : "memory"); } gcc -W -Wall -flto -o rh1948567{,-1.c,-2.c} rh1948567-1.c: In function ‘main’: rh1948567-1.c:8:3: warning: ‘foo’ accessing 2 bytes in a region of size 1 [-Wstringop-overflow=] 8 | foo (x + 1); | ^ rh1948567-1.c:8:3: note: referencing argument 1 of type ‘char[2]’ rh1948567-2.c:2:1: note: in a call to function ‘foo’ 2 | foo (char x[2]) | ^ Shouldn't the diagnostic pragma prevent the warning even in the LTO case?
(In reply to Jakub Jelinek from comment #0) > Shouldn't the diagnostic pragma prevent the warning even in the LTO case? Yes but I don't think it is streamed out. See PR 80922 (and a few others in the see also). Confirmed.