https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80304
--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- I also get a wrong result if I compile the test with -O1 -fno-auto-inc-dec -fno-branch-count-reg -fno-combine-stack-adjustments -fno-compare-elim -fno-cprop-registers -fno-dce -fno-defer-pop -fno-delayed-branch -fno-dse -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-reorder-blocks -fno-shrink-wrap -fno-shrink-wrap-separate -fno-split-wide-types -fno-ssa-backprop -fno-ssa-phiopt -fno-tree-bit-ccp -fno-tree-ccp -fno-tree-ch -fno-tree-coalesce-vars -fno-tree-copy-prop -fno-tree-dce -fno-tree-dominator-opts -fno-tree-dse -fno-tree-forwprop -fno-tree-fre -fno-tree-phiprop -fno-tree-sink -fno-tree-slsr -fno-tree-sra -fno-tree-pta -fno-tree-ter -fno-unit-at-a-time -fno-omit-frame-pointer i.e., with all the controlled optimisations at -O1 disabled. The code gives the expected result when compiled with -O1 -finline-small-functions.