[llvm-commits] PATCH: Fix crash in APInt.cpp

James Benton jbenton at vmware.com
Mon Jun 11 05:08:40 PDT 2012


On 10/06/12 03:01, Jakob Stoklund Olesen wrote:
>
> On Jun 8, 2012, at 6:18 AM, James Benton wrote:
>
>> Fixed the following crash in llvm::APInt::lshr when shiftAmt > BitWidth.
>> Added a test which causes this crash.
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x0000000000ff5c9d in llvm::APInt::lshr (this=0x7fffffffc880, 
>> shiftAmt=160)
>>    at /home/james/private_vmware/llvm/lib/Support/APInt.cpp:1173
>> 1173                 (pVal[i+offset+1] << (APINT_BITS_PER_WORD - 
>> wordShift));
>>
>>
>> #0  0x0000000000ff5c9d in llvm::APInt::lshr (this=0x7fffffffc870, 
>> shiftAmt=160)
>>    at llvm/lib/Support/APInt.cpp:1173
>> #1  0x00000000009168d2 in (anonymous 
>> namespace)::DAGCombiner::visitAND (this=0x7fffffffcf90, N=0x181b3c0)
>>    at llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2496
>> <diff.txt>_______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu <mailto:llvm-commits at cs.uiuc.edu>
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> The test is failing here: 
> http://lab.llvm.org:8011/builders/llvm-arm-linux/builds/1170
>
> ******************** TEST 'LLVM :: CodeGen/Generic/2012-06-08-APIntCrash.ll' FAILED ********************Script:
> --
> /wd/buildbot/llvm-arm-linux/llvm/Debug+Asserts/bin/llc<  /wd/buildbot/llvm-arm-linux/llvm/test/CodeGen/Generic/2012-06-08-APIntCrash.ll
> --
> Exit Code: 134
> Command Output (stderr):
> --
> Return operand #4 has unhandled type i32UNREACHABLE executed at CallingConvLower.cpp:112!
> 0  llc       0x01208534
> 1  llc       0x01208ebc
> 2  libc.so.6 0x4021cc10 __default_sa_restorer_v2 + 0
> Stack dump:
> 0.	Program arguments: /wd/buildbot/llvm-arm-linux/llvm/Debug+Asserts/bin/llc
> 1.	Running pass 'Function Pass Manager' on module '<stdin>'.
> 2.	Running pass 'ARM Instruction Selection' on function '@test1'
> /wd/buildbot/llvm-arm-linux/llvm/test/CodeGen/Generic/Output/2012-06-08-APIntCrash.ll.script: line 2: 29742 Aborted                 '/wd/buildbot/llvm-arm-linux/llvm/Debug+Asserts/bin/llc'<  '/wd/buildbot/llvm-arm-linux/llvm/test/CodeGen/Generic/2012-06-08-APIntCrash.ll'
> --
>
> ********************
>

I have modified the test to the following (there is also a diff attached).
Verified to compile with ARM and still able to produce a crash using 
this test before my patch.

; RUN: llc < %s

define void @test1(<8 x i32>* %ptr)
{
     %1 = load <8 x i32>* %ptr, align 32
     %2 = and <8 x i32> %1, <i32 0, i32 0, i32 0, i32 -1, i32 0, i32 0, 
i32 0, i32 -1>
     store <8 x i32> %2, <8 x i32>* %ptr, align 16
     ret void
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120611/9e67f83e/attachment.html>
-------------- next part --------------
Index: test/CodeGen/Generic/2012-06-08-APIntCrash.ll
===================================================================
--- test/CodeGen/Generic/2012-06-08-APIntCrash.ll	(revision 158306)
+++ test/CodeGen/Generic/2012-06-08-APIntCrash.ll	(working copy)
@@ -1,8 +1,9 @@
 ; RUN: llc < %s
 
-define <8 x i32> @test1(<8 x i32>* %ptr)
+define void @test1(<8 x i32>* %ptr)
 {
 	%1 = load <8 x i32>* %ptr, align 32
 	%2 = and <8 x i32> %1, <i32 0, i32 0, i32 0, i32 -1, i32 0, i32 0, i32 0, i32 -1>
-	ret <8 x i32> %2;
+	store <8 x i32> %2, <8 x i32>* %ptr, align 16
+	ret void
 }



More information about the llvm-commits mailing list