[LLVMbugs] [Bug 1698] New: Constant cast of double to short gives wrong result

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Sep 24 12:08:51 PDT 2007


           Summary: Constant cast of double to short gives wrong result
           Product: new-bugs
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: baldrick at free.fr
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=1139)
 --> (http://llvm.org/bugs/attachment.cgi?id=1139)
C testcase

Casting 0x405FBFFFFFFFE483 to i16 results in 127 rather than 126, as
shown by doing the following with the attached testcase tc.c:

llvm-gcc -S -emit-llvm tc.c -o - | llvm-as | opt -std-compile-opts | llvm-dis

define i32 @main() {
        tail call void @abort( )

This should return 0, which is what happens if you compile with
mainline gcc.  It is also what happens with llvm-gcc if you
compile without optimization.

Reduced from a recently introduced Ada testsuite failure.

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