[Bug lto/107936] New: #pragma GCC diagnostic ignored vs. LTO
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Nov 30 16:01:29 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107936
Bug ID: 107936
Summary: #pragma GCC diagnostic ignored vs. LTO
Product: gcc
Version: 12.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
CC: marxin at gcc dot gnu.org
Target Milestone: ---
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?
More information about the Gcc-bugs
mailing list