[Bug c/110683] wrong code with '-O2 -fpack-struct'

2023-07-17 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110683 Richard Biener changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug c/110683] wrong code with '-O2 -fpack-struct'

2023-07-16 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110683 --- Comment #5 from Andrew Pinski --- ms.c:299:24: warning: taking address of packed member of 'union U1' may result in an unaligned pointer value [-Waddress-of-packed-member]

[Bug c/110683] wrong code with '-O2 -fpack-struct'

2023-07-16 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110683 --- Comment #4 from Andrew Pinski --- (In reply to CTC from comment #3) > The reduced program is > > # cat mss.i > struct a { > char b; > int c; > }; > union { > struct a b; > short c; > } d = {8, 1}; > void main() { printf("%d\n", d.c)

[Bug c/110683] wrong code with '-O2 -fpack-struct'

2023-07-16 Thread 19373742 at buaa dot edu.cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110683 --- Comment #3 from CTC <19373742 at buaa dot edu.cn> --- The reduced program is # cat mss.i struct a { char b; int c; }; union { struct a b; short c; } d = {8, 1}; void main() { printf("%d\n", d.c); }