GCC5 optimization level causes runtime error in WINE
Jonathan Wakely
jwakely.gcc@gmail.com
Sun Mar 8 12:30:00 GMT 2015
On 7 March 2015 at 23:16, Michael Cronenworth wrote:
> Hello,
>
> I am attempting to debug why WINE[1], when compiled with GCC 5[2] on Fedora
> Rawhide, cannot run when an optimization level is specified.
>
> -O0 : works
> -O1 : segfault
> -O2 : segfault
Do you have any more details available somewhere I can see them? Maybe
in Fedora's bugzilla or on the devel@ list?
> I have enabled -O1 flags manually and WINE works. What other settings is GCC
> 5 enabling between optimization levels? I have run -Q --help=optimizers and
> that's what I based my flag settings on, but there is something obviously
> missing that -O1 enables.
As already pointed out, turning on individual optimizations without -O
has no effect.
https://gcc.gnu.org/bugs/ advises "Before reporting that GCC compiles
your code incorrectly, compile it with gcc -Wall -Wextra and see
whether this shows anything wrong with your code. Similarly, if
compiling with -fno-strict-aliasing -fwrapv
-fno-aggressive-loop-optimizations makes a difference, your code
probably is not correct."
Although -fno-strict-aliasing is unlikely to make any difference
because strict aliasing is only enabled at -O2 and above.
You can also try -fsanitize=undefined to detect undefined behaviour at runtime.
More information about the Gcc-help
mailing list