[Bug tree-optimization/86886] Gcc miscompiles at -O3 on valid code

2018-08-08 Thread helloqirun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86886 Qirun Zhang changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug tree-optimization/86886] Gcc miscompiles at -O3 on valid code

2018-08-08 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86886 --- Comment #4 from Jonathan Wakely --- If you want to play these sort of games then you need to compile with -fno-strict-aliasing (which you should have tried anyway if you'd read https://gcc.gnu.org/bugs/ first)

[Bug tree-optimization/86886] Gcc miscompiles at -O3 on valid code

2018-08-08 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86886 --- Comment #3 from Jonathan Wakely --- Your second example has undefined behaviour, as you blatantly violate the strict aliasing rules, and -Wstrict-aliasing=2 will warn you about it: 86886.c:5:1: warning: dereferencing type-punned pointer will

[Bug tree-optimization/86886] Gcc miscompiles at -O3 on valid code

2018-08-08 Thread helloqirun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86886 --- Comment #2 from Qirun Zhang --- (In reply to Andrew Pinski from comment #1) > I don't think this is a bug. You are taking the address of a field of an > union and accessing via that address. This is not tracked at all. Here is a reduced ca

[Bug tree-optimization/86886] Gcc miscompiles at -O3 on valid code

2018-08-08 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86886 --- Comment #1 from Andrew Pinski --- I don't think this is a bug. You are taking the address of a field of an union and accessing via that address. This is not tracked at all.