[Bug ipa/97264] [11 Regression] -fpa-modref breaks va_arg on glibc

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Oct 1 11:31:31 GMT 2020


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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Andreas Schwab from comment #5)
> Why doesn't gcc warn about that?

It does:

unsigned char **q;
void foo (char *p)
{
  q = (unsigned char **)&p;
}

> gcc t.c -fstrict-aliasing -Wstrict-aliasing=2 -S
t.i: In function 'foo':
t.i:4:3: warning: dereferencing type-punned pointer will break strict-aliasing
rules [-Wstrict-aliasing]
   q = (unsigned char **)&p;
   ^

note the default level of -Wstrict-aliasing when enabled is 3 which will
not warn when the pointer is not dereferenced in the same expression.


More information about the Gcc-bugs mailing list