1 ; RUN: opt -lint -disable-output < %s |& FileCheck %s
2 target datalayout = "e-p:64:64:64"
4 declare fastcc void @bar()
5 declare void @llvm.stackrestore(i8*)
9 define i32 @foo() noreturn {
10 ; CHECK: Caller and callee calling convention differ
12 ; CHECK: Null pointer dereference
13 store i32 0, i32* null
14 ; CHECK: Null pointer dereference
16 ; CHECK: Undef pointer dereference
17 store i32 0, i32* undef
18 ; CHECK: Undef pointer dereference
20 ; CHECK: Memory reference address is misaligned
21 %x = inttoptr i32 1 to i32*
23 ; CHECK: Division by zero
25 ; CHECK: Division by zero
27 ; CHECK: Division by zero
29 ; CHECK: Division by zero
31 ; CHECK: extractelement index out of range
32 %ee = extractelement <4 x i32> zeroinitializer, i32 4
33 ; CHECK: insertelement index out of range
34 %ie = insertelement <4 x i32> zeroinitializer, i32 0, i32 4
35 ; CHECK: Shift count out of range
37 ; CHECK: Shift count out of range
39 ; CHECK: Shift count out of range
41 ; CHECK: xor(undef, undef)
42 %xx = xor i32 undef, undef
43 ; CHECK: sub(undef, undef)
44 %xs = sub i32 undef, undef
46 ; CHECK: Write to read-only memory
48 ; CHECK: Write to text section
49 store i32 8, i32* bitcast (i32()* @foo to i32*)
50 ; CHECK: Load from block address
51 %lb = load i32* bitcast (i8* blockaddress(@foo, %next) to i32*)
52 ; CHECK: Call to block address
53 call void()* bitcast (i8* blockaddress(@foo, %next) to void()*)()
54 ; CHECK: Undefined behavior: Null pointer dereference
55 call void @llvm.stackrestore(i8* null)
60 ; CHECK: Static alloca outside of entry block
62 ; CHECK: Return statement in function with noreturn attribute
67 ; CHECK: unreachable immediately preceded by instruction without side effects
71 ; CHECK: Unnamed function with non-local linkage
72 define void @0() nounwind {
76 ; CHECK: va_start called in a non-varargs function
77 declare void @llvm.va_start(i8*)
78 define void @not_vararg(i8* %p) nounwind {
79 call void @llvm.va_start(i8* %p)
83 ; CHECK: Undefined behavior: Branch to non-blockaddress
84 define void @use_indbr() {
85 indirectbr i8* bitcast (i32()* @foo to i8*), [label %block]
90 ; CHECK: Undefined behavior: Call with "tail" keyword references alloca or va_arg
91 ; CHECK: Undefined behavior: Call with "tail" keyword references alloca or va_arg
92 declare void @tailcallee(i8*)
93 define void @use_tail(i8* %valist) {
95 tail call void @tailcallee(i8* %t)
96 %s = va_arg i8* %valist, i8*
97 tail call void @tailcallee(i8* %s)