[LLVMbugs] [Bug 12852] New: x86-64 Optimizer bug on simple, one line function.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed May 16 13:30:09 PDT 2012


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

             Bug #: 12852
           Summary: x86-64 Optimizer bug on simple, one line function.
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: slembcke at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8573
  --> http://llvm.org/bugs/attachment.cgi?id=8573
Replication example.

I'm having issues with the Clang 3.1 compiler for x86-64 that comes with Xcode
4.3Ka and my open source physics library, Chipmunk. The issue wasn't present in
Clang 3.0.

I have a function which returns a simple, unit length, 2D vector struct given
an angle.
When compiling with anything other than -O0, Clang outputs a tail call to
sin().
cos() is never called, and garbage is returned from the function.

cpVect cpvforangle(const double a)
{
    return (cpVect){cos(a), sin(a)};
}


See the cpvforangle() function in clang-bug-cpVect.c and the associated
assembly file. I've attached a replication example of the bug.

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