GCC5 optimization level causes runtime error in WINE

Michael Cronenworth mike@cchtml.com
Sun Mar 8 19:56:00 GMT 2015


On 03/08/2015 03:59 AM, Alexander Monakov wrote:
> 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.

Yes, but I've tried it both ways. Setting -O1 followed by a list of -f-no-... 
options that should be the same as passing -O0 causes wine to segfault when run. 
Setting -O0 allows wine to run.

Here's the full list of CFLAGS on a working -O0 run:

-I. -I../../include -D__WINESRC__ -D_REENTRANT -fPIC -Wall -pipe \
   -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body 
-Wignored-qualifiers \
   -Wstrict-prototypes -Wtype-limits -Wunused-but-set-parameter -Wvla 
-Wwrite-strings -Wpointer-arith \
   -Wlogical-op -O0

Here's the full list on a broken -O1 run:
-I. -I../../include -D__WINESRC__ -D_REENTRANT -fPIC -Wall -pipe \
   -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body 
-Wignored-qualifiers \
   -Wstrict-prototypes -Wtype-limits -Wunused-but-set-parameter -Wvla 
-Wwrite-strings -Wpointer-arith \
   -Wlogical-op -O1 -fno-branch-count-reg -fno-combine-stack-adjustments 
-fno-compare-elim -fno-cprop-registers -fno-defer-pop -fno-forward-propagate 
-fno-guess-branch-probability -fno-if-conversion2 -fno-if-conversion 
-fno-inline-functions-called-once -fno-ipa-pure-const -fno-ipa-profile 
-fno-ipa-reference -fno-merge-constants -fno-move-loop-invariants -fno-shrink-wrap 
-fno-split-wide-types -fno-ssa-phiopt -fno-tree-bit-ccp -fno-tree-ccp -fno-tree-ch 
-fno-tree-copy-prop -fno-tree-copyrename -fno-tree-dce -fno-tree-dominator-opts 
-fno-tree-dse -fno-tree-fre -fno-tree-sink -fno-tree-slsr -fno-tree-sra 
-fno-tree-pta -fno-tree-ter

> 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.

 From the same documentation that you quoted.

    Depending on the target and how GCC was configured, a slightly
    different set of optimizations may be enabled at each -O level than
    those listed here. You can invoke GCC with -Q --help=optimizers to find
    out the exact set of optimizations that are enabled at each level.

Thanks,
Michael



More information about the Gcc-help mailing list