add another case of undefined behavior without crashing, PR3466.
[oota-llvm.git] / test / Transforms / ScalarRepl / badarray.ll
1 ; RUN: llvm-as < %s | opt -scalarrepl -instcombine | llvm-dis | not grep alloca
2 ; PR3466
3
4 define i32 @test() {
5         %X = alloca [4 x i32]           ; <[4 x i32]*> [#uses=1]
6         ; Off end of array!
7         %Y = getelementptr [4 x i32]* %X, i64 0, i64 6          ; <i32*> [#uses=2]
8         store i32 0, i32* %Y
9         %Z = load i32* %Y               ; <i32> [#uses=1]
10         ret i32 %Z
11 }
12
13
14 define i32 @test2() nounwind {
15 entry:
16         %yx2.i = alloca float, align 4          ; <float*> [#uses=1]            
17         %yx26.i = bitcast float* %yx2.i to i64*         ; <i64*> [#uses=1]      
18         %0 = load i64* %yx26.i, align 8         ; <i64> [#uses=0]               
19         unreachable
20 }