[LLVMbugs] [Bug 6153] New: Bitcasts between arrays are incorrectly accepted, causing llc to crash

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Jan 26 13:35:58 PST 2010


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

           Summary: Bitcasts between arrays are incorrectly accepted,
                    causing llc to crash
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: crash-on-invalid
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: matti.niemenmaa+llvmbugs at iki.fi
                CC: llvmbugs at cs.uiuc.edu


LLVM like the following is happily accepted by both the verifier and the
parser:

@x = constant [1 x i32] bitcast ([4 x i8] c"abcd" to [1 x i32])

However, this is invalid, as the reference says: "[t]he 'bitcast' instruction
takes a value to cast, which must be a **non-aggregate** first class value, and
a type to cast it to, which must also be a **non-aggregate** first class type."
(emphasis added).

On both 2.6 and trunk, accepting this nonsense eventually leads to llc
executing unreachable, at least on x86 and x86-64: (thanks to Dan Gohman for
confirming that trunk is affected)

x:                                                          # @x
        .byte   UNREACHABLE executed!
0   llc             0x0000000000d2d0bf
1   llc             0x0000000000d2d70d
2   libpthread.so.0 0x00007ffde0664e80
3   libc.so.6       0x00007ffddf986035 gsignal + 53
4   libc.so.6       0x00007ffddf987460 abort + 384
5   llc             0x0000000000d13d94 llvm::llvm_unreachable_internal(char
const*, char const*, unsigned int) + 356
...

Snipped the stack trace as it's not really relevant, the program shouldn't even
get that far.


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