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

--- Comment #3 from Hao Zhang <theivorytower at gmail dot com> ---
(In reply to Hao Zhang from comment #2)
> (In reply to Martin Liška from comment #1)
> > Can't reproduce, can you please provide options you use to build the
> > executable?
> 
> I didn't use any extra options besides g++ pow.cpp, and both my CFLAGS and
> CXXFLAGS environment variables are empty. And I just found out moments ago
> compiling with -O1 gives the right result while compiling with -O0 gives the
> wrong result. I also tried to turn on each of the 42 optimizations provided
> by -O1 individually, and I found none of the 42 optimizations ALONE can get
> rid of the problem. So there must be some combinations of optimizations that
> can get rid of the problem. 
> 
> My glibc version is 2.25 and kernel version is 4.10.9. And I have reproduced
> the error on two different computers. Is there any other information I can
> provide to help pinpoint the problem? Thanks!

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?

Reply via email to