[LLVMbugs] [Bug 7624] New: incorrect x87 code generated for comparison

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jul 12 04:31:59 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=7624

           Summary: incorrect x87 code generated for comparison
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jay.foad at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=5214)
 --> (http://llvm.org/bugs/attachment.cgi?id=5214)
test case

With the attached test case I get:

$ clang -m32 -mno-sse -o w w.c
$ ./w
[should return after one second, but in fact loops forever]

The code generated for "while (get() < d)" looks like this:

 8048440:       e8 9b ff ff ff          call   80483e0 <get>
 8048445:       dd 45 f0                fldl   -0x10(%ebp)
 8048448:       da e9                   fucompp 
 804844a:       76 0b                   jbe    8048457 <main+0x37>

This won't work because fucompp leaves the result of the comparison in the FPU
flags, but "jbe" tests the CPU flags.

I'm using Clang and LLVM built from trunk this morning, on Ubuntu 10.4 x86_64.

-- 
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