[LLVMbugs] [Bug 10881] New: Compiler optimizer generates incorrect i386 code
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Sep 7 04:25:00 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10881
Summary: Compiler optimizer generates incorrect i386 code
Product: clang
Version: unspecified
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: eric.trepanier at gmail.com
CC: llvmbugs at cs.uiuc.edu
Created an attachment (id=7234)
--> (http://llvm.org/bugs/attachment.cgi?id=7234)
Small Foundation Obj-C program that demonstrates the issue
The attached code sample demonstrates a situation in which the 32-bit compiler
optimizer generates incorrect code for a given while loop.
Compile the attached source file using the following command:
clang -arch i386 -framework Foundation -Os main.m
The run the resulting executable, you should see the following result:
2011-09-07 07:19:42.458 a.out[27557:507] Calculating r using while loop =
{{287, 733}, {33.000004, 5.0509523e-40}}
2011-09-07 07:19:42.460 a.out[27557:507] Calculating r without using while loop
= {{287, 733}, {33.000004, 15.999994}}
If you disable compiler optimizations, (-O0), you will instead see that the
calculated "r" results are the same in both cases:
2011-09-07 07:23:20.042 a.out[27564:507] Calculating r using while loop =
{{287, 733}, {33.000004, 15.999994}}
2011-09-07 07:23:20.044 a.out[27564:507] Calculating r without using while loop
= {{287, 733}, {33.000004, 15.999994}}
Our code was initially using the while-loop approach and generating some
incorrect results. Fortunately, unrolling the loop works around the problem for
us so it is not a showstopper, but it's probably something you want to look at
nonetheless.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list