blob: 8658495c9714e4c0cf1568665083ebbd35c1cf77 [file] [log] [blame]
Dan Gohman113902e2010-04-08 18:47:09 +00001; RUN: opt -lint -disable-output < %s |& FileCheck %s
2target datalayout = "e-p:64:64:64"
3
4declare fastcc void @bar()
5
6define i32 @foo() noreturn {
7; CHECK: Caller and callee calling convention differ
8 call void @bar()
9; CHECK: Null pointer dereference
10 store i32 0, i32* null
11; CHECK: Null pointer dereference
12 %t = load i32* null
Dan Gohmandd98c4d2010-04-08 23:05:57 +000013; CHECK: Undef pointer dereference
14 store i32 0, i32* undef
15; CHECK: Undef pointer dereference
16 %u = load i32* undef
Dan Gohman113902e2010-04-08 18:47:09 +000017; CHECK: Memory reference address is misaligned
18 %x = inttoptr i32 1 to i32*
19 load i32* %x, align 4
20; CHECK: Division by zero
21 %sd = sdiv i32 2, 0
22; CHECK: Division by zero
23 %ud = udiv i32 2, 0
24; CHECK: Division by zero
25 %sr = srem i32 2, 0
26; CHECK: Division by zero
27 %ur = urem i32 2, 0
Dan Gohmandd98c4d2010-04-08 23:05:57 +000028; CHECK: extractelement index out of range
29 %ee = extractelement <4 x i32> zeroinitializer, i32 4
30; CHECK: insertelement index out of range
31 %ie = insertelement <4 x i32> zeroinitializer, i32 0, i32 4
32; CHECK: Shift count out of range
33 %r = lshr i32 0, 32
34; CHECK: Shift count out of range
35 %q = ashr i32 0, 32
36; CHECK: Shift count out of range
37 %l = shl i32 0, 32
Dan Gohmanbe02b202010-04-09 01:39:53 +000038; CHECK: xor(undef, undef)
39 %xx = xor i32 undef, undef
40; CHECK: sub(undef, undef)
41 %xs = sub i32 undef, undef
Dan Gohman113902e2010-04-08 18:47:09 +000042 br label %next
43
44next:
45; CHECK: Static alloca outside of entry block
46 %a = alloca i32
47; CHECK: Return statement in function with noreturn attribute
48 ret i32 0
Dan Gohmanbe02b202010-04-09 01:39:53 +000049
50foo:
51 %z = add i32 0, 0
52; CHECK: unreachable immediately preceded by instruction without side effects
53 unreachable
54}
55
56; CHECK: Unnamed function with non-local linkage
57define void @0() nounwind {
58 ret void
59}
60
61; CHECK: va_start called in a non-varargs function
62declare void @llvm.va_start(i8*)
63define void @not_vararg(i8* %p) nounwind {
64 call void @llvm.va_start(i8* %p)
65 ret void
Dan Gohman113902e2010-04-08 18:47:09 +000066}