https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115049

--- Comment #4 from Jörn Heusipp <manx-bugzilla at problemloesungsmaschine dot 
de> ---
Using '-Q --help=optimizers' to verify, "-O2" is equivalent to "
-O1 \
-falign-functions=16 \
-falign-jumps=16:11:8 \
-falign-labels=0:0:8 \
-falign-loops=16:11:8 \
-fcaller-saves \
-fcode-hoisting \
-fcrossjumping \
-fcse-follow-jumps \
-fdevirtualize \
-fdevirtualize-speculatively \
-fexpensive-optimizations \
-fgcse \
-fhoist-adjacent-loads \
-findirect-inlining \
-finline-functions \
-finline-small-functions \
-fipa-bit-cp \
-fipa-cp \
-fipa-icf \
-fipa-icf-functions \
-fipa-icf-variables \
-fipa-ra \
-fipa-sra \
-fipa-vrp \
-fisolate-erroneous-paths-dereference \
-flra-remat \
-fopenmp-target-simd-clone=nohost \
-foptimize-sibling-calls \
-foptimize-strlen \
-fpartial-inlining \
-fpeephole2 \
-free \
-freorder-blocks-algorithm=stc \
-freorder-functions \
-frerun-cse-after-loop \
-fschedule-insns2 \
-fstore-merging \
-fstrict-aliasing \
-ftree-loop-distribute-patterns \
-ftree-loop-vectorize \
-ftree-pre \
-ftree-slp-vectorize \
-ftree-switch-conversion \
-ftree-tail-merge \
-ftree-vrp \
-funroll-loops \
-fvect-cost-model=very-cheap \
-fno-rename-registers \
-fno-web \
"
for me.

If I remove any of '-fexpensive-optimizations' / '-finline-small-functions' /
'-fipa-ra' / '-ftree-vrp', the problem goes away.

When adding solely these 4 options in addition to '-O1', the problem does not
show up though. It requires also adding '-finline-functions' additionally to
trigger. And in this situation, I can remove '-fexpensive-optimizations' and it
still triggers. It does not crash in exactly the same position with this
"minimal" set of optimization flags (it crashes before the 1st printf instead
of before the 3rd), however it surely still should not crash at all. The same
symbol-removing hack still makes it work.

I cannot pinpoint a single optimization flag to trigger the problem alone, so
there appears to be some inter-dependencies between optimization passes (which
is not at all surprising to me).

This is sadly not 100% conclusive.

I somewhat doubt this is already decidable: Would '-O2
-fno-inline-small-functions -fno-ipa-ra -fno-tree-vrp' instead of forcing '-O1'
be a safe work-around for me to use in production?
  • [Bug tree-opt... jason at gcc dot gnu.org via Gcc-bugs
    • [Bug tre... sjames at gcc dot gnu.org via Gcc-bugs
    • [Bug tre... manx-bugzilla at problemloesungsmaschine dot de via Gcc-bugs
    • [Bug tre... manx-bugzilla at problemloesungsmaschine dot de via Gcc-bugs
    • [Bug tre... jason at gcc dot gnu.org via Gcc-bugs
    • [Bug tre... jason at gcc dot gnu.org via Gcc-bugs

Reply via email to