[Bug rtl-optimization/57359] wrong code for union access at -O3 on x86_64-linux
dhazeghi at yahoo dot com
gcc-bugzilla@gcc.gnu.org
Fri May 31 16:32:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57359
--- Comment #8 from Dara Hazeghi <dhazeghi at yahoo dot com> ---
Okay, here is I think a more clear example. However, from what Jakub says
above, this is probably undefined.
int printf(const char *, ...);
union
{
int i;
long long ll;
} u;
long long *pll = &u.ll;
int *pi = &u.i;
int a = 1, *pa = &a;
void
foo ()
{
int i = 0;
for (; i <= 1; i++)
{
*pll = a;
*pi = 0;
a = *pa;
}
}
int
main ()
{
foo ();
printf ("%d\n", u.i);
return 0;
}
More information about the Gcc-bugs
mailing list