diff options
author | Dan Gohman <gohman@apple.com> | 2010-04-08 18:47:09 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-04-08 18:47:09 +0000 |
commit | 113902e9fba5f4baf3de3c6ac0241d49ffdfa55c (patch) | |
tree | 6dfba08b4cf2caa687d66c3db1e33258df8b462d /test/Other/lint.ll | |
parent | e37b0c6c25262b6c9ef4f1595b18e77f299b5035 (diff) | |
download | external_llvm-113902e9fba5f4baf3de3c6ac0241d49ffdfa55c.zip external_llvm-113902e9fba5f4baf3de3c6ac0241d49ffdfa55c.tar.gz external_llvm-113902e9fba5f4baf3de3c6ac0241d49ffdfa55c.tar.bz2 |
Add a -lint pass which checks for common sources of undefined or likely
unintended behavior.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100798 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Other/lint.ll')
-rw-r--r-- | test/Other/lint.ll | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/Other/lint.ll b/test/Other/lint.ll new file mode 100644 index 0000000..6ccaa6f --- /dev/null +++ b/test/Other/lint.ll @@ -0,0 +1,31 @@ +; RUN: opt -lint -disable-output < %s |& FileCheck %s +target datalayout = "e-p:64:64:64" + +declare fastcc void @bar() + +define i32 @foo() noreturn { +; CHECK: Caller and callee calling convention differ + call void @bar() +; CHECK: Null pointer dereference + store i32 0, i32* null +; CHECK: Null pointer dereference + %t = load i32* null +; CHECK: Memory reference address is misaligned + %x = inttoptr i32 1 to i32* + load i32* %x, align 4 +; CHECK: Division by zero + %sd = sdiv i32 2, 0 +; CHECK: Division by zero + %ud = udiv i32 2, 0 +; CHECK: Division by zero + %sr = srem i32 2, 0 +; CHECK: Division by zero + %ur = urem i32 2, 0 + br label %next + +next: +; CHECK: Static alloca outside of entry block + %a = alloca i32 +; CHECK: Return statement in function with noreturn attribute + ret i32 0 +} |