https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80432
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Hao Zhang from comment #2) > both my CFLAGS and CXXFLAGS environment variables are empty. That's irrelevant, GCC doesn't care about those environment variables. (In reply to Hao Zhang from comment #3) > I also found out that g++ -O1 pow.cpp gives the expected results, while the > following command gives the wrong results: > > g++ -fauto-inc-dec -fbranch-count-reg -fcombine-stack-adjustments > -fcompare-elim -fcprop-registers -fdce -fdefer-pop -fdelayed-branch -fdse > -fforward-propagate -fguess-branch-probability -fif-conversion2 > -fif-conversion -finline-functions-called-once -fipa-pure-const > -fipa-profile -fipa-reference -fmerge-constants -fmove-loop-invariants > -freorder-blocks -fshrink-wrap -fshrink-wrap-separate -fsplit-wide-types > -fssa-backprop -fssa-phiopt -ftree-bit-ccp -ftree-ccp -ftree-ch > -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts > -ftree-dse -ftree-forwprop -ftree-fre -ftree-phiprop -ftree-sink -ftree-slsr > -ftree-sra -ftree-pta -ftree-ter -funit-at-a-time -fomit-frame-pointer > pow.cpp > > This is weird, isn't the two forms of command equivalent? No. See https://gcc.gnu.org/wiki/FAQ#optimization-options