GCC5 optimization level causes runtime error in WINE
Alexander Monakov
amonakov@ispras.ru
Sun Mar 8 08:59:00 GMT 2015
On Sat, 7 Mar 2015, 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
>
> 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.
GCC manual explains the behavior:
Most optimizations are only enabled if an -O level is set on the command
line. Otherwise they are disabled, even if individual optimization flags
are specified.
As a result, you can use -O1 and disable individual optimizations with
-fno-... instead.
Out of curiousity, where did you find the -Q --help=optimizers incantation?
I've always thought it's a rarer bit of knowledge than the -O flag behavior.
Alexander
More information about the Gcc-help
mailing list