This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/78386] New: Powerpc64le: optimization -O2 and higher cause math inconsitency
- From: "brenohl at br dot ibm.com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 16 Nov 2016 20:15:44 +0000
- Subject: [Bug c/78386] New: Powerpc64le: optimization -O2 and higher cause math inconsitency
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78386
Bug ID: 78386
Summary: Powerpc64le: optimization -O2 and higher cause math
inconsitency
Product: gcc
Version: 6.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: brenohl at br dot ibm.com
Target Milestone: ---
When compiling fdlibm with O2 or higher, the math results are different.
I just write a simple example, invoking jcos() and invoking it several times.
If I use -O1 and -O2, the results are different. I dug further and found that
the problem happens when using the optimization '-expensive-optimizations'.
As for example:
$ gcc -I. -g -static -O1 -fexpensive-optimizations .. -o opt_call
$ gcc -I. -g -static -O1 .. -o call
$ ./opt_call
cosine total sum is: 0.33853897900538427
$ ./call
cosine total sum is: 0.33853897900536206
I wrote a testcase to show this problem, please find it at
https://github.com/leitao/fdlibm/tree/master/gcc_bug:
In order to reproduce the problem, just run:
$ git clone https://github.com/leitao/fdlibm.git
$ cd fdlibm/gcc_bug
$ make
$ ./call
$ ./opt_call
If any other detail is required, I can dig further:
Machine Information:
$ gcc --version
gcc (Debian 6.2.0-13) 6.2.0 20161109
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ uname -a
Linux testing 4.7.0-1-powerpc64le #1 SMP Debian 4.7.8-1 (2016-10-19) ppc64le
GNU/Linux