[LLVMbugs] [Bug 10117] New: Strange multiplication result possibly related to trapping

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 9 16:41:50 PDT 2011


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

           Summary: Strange multiplication result possibly related to
                    trapping
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: wendling at apple.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=6719)
 --> (http://llvm.org/bugs/attachment.cgi?id=6719)
Shows the failing program.

The attached program when run claims that 29 * 29 == 1711. This isn't exactly
correct. 

$ clang++ -o bar -O1 -fPIC foo.cpp
$ ./bar
...

diffX: 29 diffY: 0
diffX squared: 1711
diffY squared: 0
diffX * diffX + diffY * diffY :: 1711
a 41.3642
41.3642

If you use -ftrapv, the value is okay. But there doesn't seem to be any
undefined behavior here.

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