[llvm-commits] [poolalloc] r155801 - /poolalloc/trunk/test/dsa/regression/2012-04-29.StructOOBIndex.ll

Will Dietz wdietz2 at illinois.edu
Sun Apr 29 15:00:20 PDT 2012


Author: wdietz2
Date: Sun Apr 29 17:00:20 2012
New Revision: 155801

URL: http://llvm.org/viewvc/llvm-project?rev=155801&view=rev
Log:
Add testcase reduced from 483.xalancbmk, presently causes assertion failure.

(As does 483.xalancbmk itself)

Added:
    poolalloc/trunk/test/dsa/regression/2012-04-29.StructOOBIndex.ll

Added: poolalloc/trunk/test/dsa/regression/2012-04-29.StructOOBIndex.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/regression/2012-04-29.StructOOBIndex.ll?rev=155801&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/regression/2012-04-29.StructOOBIndex.ll (added)
+++ poolalloc/trunk/test/dsa/regression/2012-04-29.StructOOBIndex.ll Sun Apr 29 17:00:20 2012
@@ -0,0 +1,15 @@
+; OOB indexing example reduced from 483.xalancbmk
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+%structType = type { i32, i8*, i32 }
+
+define i32 @foo(%structType* %t) {
+  ; Treat 't' as an array of structs, and index to the 'i8*' in the second one
+  %ptr = getelementptr inbounds %structType* %t, i64 1, i32 1
+  ; Cast so indexing past end of struct is 'allowed'
+  %cast = bitcast i8** %ptr to %structType*
+  ; Get pointer to second 'i32' that's now OOB of the original struct type
+  %ptr2 = getelementptr inbounds %structType* %cast, i32 0, i32 2
+  ret i32 0
+}





More information about the llvm-commits mailing list