[Bug c/42179] Incorrect optimization (-O2) yields wrong code (regression)

2009-11-26 Thread rguenth at gcc dot gnu dot org
--- Comment #1 from rguenth at gcc dot gnu dot org 2009-11-26 09:56 --- Aliasing rules are indeed broken because you access a union of anonymous type through a pointer to a union of type ieee_double_extract. I think you want union { union ieee_double_extract d; unsigned long long

[Bug c/42179] Incorrect optimization (-O2) yields wrong code (regression)

2009-11-26 Thread d dot g dot gorbachev at gmail dot com
--- Comment #2 from d dot g dot gorbachev at gmail dot com 2009-11-26 11:02 --- note that there are no warnings A warning is issued with -Wstrict-aliasing=1 or -Wstrict-aliasing=2, but no warning with -Wstrict-aliasing=3 (or -Wall). I see there are already a few bug reports about

[Bug c/42179] Incorrect optimization (-O2) yields wrong code (regression)

2009-11-26 Thread rguenth at gcc dot gnu dot org
--- Comment #3 from rguenth at gcc dot gnu dot org 2009-11-26 11:25 --- Correct. We can either produce possibly lots of false positives or not warn. Warning in the cases where we can prove your code is wrong would be pointless as in that case we'd better take measures to not miscompile

[Bug c/42179] Incorrect optimization (-O2) yields wrong code (regression)

2009-11-26 Thread vincent at vinc17 dot org
--- Comment #4 from vincent at vinc17 dot org 2009-11-26 15:53 --- (In reply to comment #1) Aliasing rules are indeed broken because you access a union of anonymous type through a pointer to a union of type ieee_double_extract. OK, the real code in MPFR is a double accessed through a

[Bug c/42179] Incorrect optimization (-O2) yields wrong code (regression)

2009-11-26 Thread rguenth at gcc dot gnu dot org
--- Comment #5 from rguenth at gcc dot gnu dot org 2009-11-26 16:39 --- The frontend code should indeed be able to unconditionally warn for ((union ieee_double_extract *)(x.d))-s.exp because it can see both the underlying object and the access through the non-conflicting type. --