[LLVMdev] lli interpreter crashed for integer type whose bitwidth > 64

Zhou Sheng zhousheng00 at gmail.com
Mon Dec 3 00:09:31 PST 2007


The lli interpreter  crashed for the following case:

; ModuleID = 'x.c'
target datalayout =
target triple = "i686-pc-linux-gnu"

define i32 @main() {
    %retval = alloca i32        ; <i32*> [#uses=2]
    %tmp = alloca i32       ; <i32*> [#uses=2]
    %x = alloca i75, align 16       ; <i75*> [#uses=1]
    %"alloca point" = bitcast i32 0 to i32      ; <i32> [#uses=0]
    store i75 999, i75* %x, align 16
    store i32 0, i32* %tmp, align 4
    %tmp1 = load i32* %tmp, align 4     ; <i32> [#uses=1]
    store i32 %tmp1, i32* %retval, align 4
    br label %return

return:     ; preds = %entry
    %retval2 = load i32* %retval        ; <i32> [#uses=1]
    ret i32 %retval2

The output is :

*** glibc detected *** lli: free(): invalid pointer: 0x088cb1d8 ***
======= Backtrace: =========
... ...

I checked the llvm svn log, this is due to the patch from " svn diff
The replacement of getABITypeSize with getTypeSize caused it.
This seems an alignment unmatch issue. As for type i75, the
getABITypeSize/getABITypeAlignment  will return 10 while in APInt, it
actually allocated two-64bit-array (128bit totally) hence the malloc/free

Ciao, can you take a look at it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20071203/935fe752/attachment.html>

More information about the llvm-dev mailing list