[Bug target/63661] New: -O2 miscompiles on OSX 10.10 Yosemite
vbraun.name at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Oct 27 19:03:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63661
Bug ID: 63661
Summary: -O2 miscompiles on OSX 10.10 Yosemite
Product: gcc
Version: 4.9.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: vbraun.name at gmail dot com
Created attachment 33821
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33821&action=edit
Testcase that yields wrong answer when compiled with -O2
The attached selfcontained test_mathieu.c is based on the GSL testsuite. I
tried to make it shorter but simple changes like adding printf tend to "fix"
it. Compilation fails on OSX 10.10 Yosemite when compiled with -O2:
$ gcc -O0 -o test_mathieu test_mathieu.c -lm && ./test_mathieu
loop -2.35802
loop 2
loop 2
loop 2
loop 2
$ gcc -O1 -o test_mathieu test_mathieu.c -lm && ./test_mathieu
loop -2.35802
loop 2
loop 2
loop 2
loop 2
$ gcc -O2 -o test_mathieu test_mathieu.c -lm && ./test_mathieu
loop -2.35802
loop 2.35802
loop 2.35802
loop 2.35802
loop 2.35802
Notes:
* The non-optimized values are the correct ones.
* Works on linux x86_64 with gcc 4.9.1 (Fedora 21 alpha)
* Works with Apple clang
More information about the Gcc-bugs
mailing list