Zhou Sheng
2007-Dec-03 08:09 UTC
[LLVMdev] lli interpreter crashed for integer type whose bitwidth > 64
Hi, The lli interpreter crashed for the following case: ; ModuleID = 'x.c' target datalayout "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" target triple = "i686-pc-linux-gnu" define i32 @main() { entry: %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: ========/lib/libc.so.6[0x479efd] /lib/libc.so.6(cfree+0x90)[0x47d550] lli(_ZN4llvm12AllocaHolderD1Ev+0x2b)[0x84bcb4d] lli(_ZN4llvm18AllocaHolderHandleD1Ev+0x37)[0x84bcbab] lli(_ZN4llvm16ExecutionContextD1Ev+0x14)[0x84bd780] lli(_ZN9__gnu_cxx13new_allocatorIN4llvm16ExecutionContextEE7destroyEPS2_+0x11)[0x84bd7af] ... ... I checked the llvm svn log, this is due to the patch from " svn diff -r43619:43620" 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 crashed. 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>
Duncan Sands
2007-Dec-03 08:25 UTC
[LLVMdev] lli interpreter crashed for integer type whose bitwidth > 64
Hi,> 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 > crashed.indeed ExecutionEngine.cpp needs to be updated. Can you please open a bugreport for this. Thanks, Duncan.