diff options
author | Dan Gohman <gohman@apple.com> | 2010-05-26 22:21:25 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-05-26 22:21:25 +0000 |
commit | f85cd8bc137c6afcfbee95a1ec74379cbe027862 (patch) | |
tree | c80eb03d7dc1eafb2a29a603bc9a5b39338e041c | |
parent | 484f24d4a4dd89634067c93ad3efbd13cf634c23 (diff) | |
download | external_llvm-f85cd8bc137c6afcfbee95a1ec74379cbe027862.zip external_llvm-f85cd8bc137c6afcfbee95a1ec74379cbe027862.tar.gz external_llvm-f85cd8bc137c6afcfbee95a1ec74379cbe027862.tar.bz2 |
Reinstate checking of stackrestore, with checking for both Read
and Write, and add a comment explaining this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104756 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Analysis/Lint.cpp | 8 | ||||
-rw-r--r-- | test/Other/lint.ll | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/Analysis/Lint.cpp b/lib/Analysis/Lint.cpp index a19e13e..1fae14f 100644 --- a/lib/Analysis/Lint.cpp +++ b/lib/Analysis/Lint.cpp @@ -285,6 +285,14 @@ void Lint::visitCallSite(CallSite CS) { visitMemoryReference(I, CS.getArgument(0), 0, 0, MemRef::Read | MemRef::Write); break; + + case Intrinsic::stackrestore: + // Stackrestore doesn't read or write memory, but it sets the + // stack pointer, which the compiler may read from or write to + // at any time, so check it for both readability and writeability. + visitMemoryReference(I, CS.getArgument(0), 0, 0, + MemRef::Read | MemRef::Write); + break; } } diff --git a/test/Other/lint.ll b/test/Other/lint.ll index eb0b762..1f9efe3 100644 --- a/test/Other/lint.ll +++ b/test/Other/lint.ll @@ -2,6 +2,7 @@ target datalayout = "e-p:64:64:64" declare fastcc void @bar() +declare void @llvm.stackrestore(i8*) @CG = constant i32 7 @@ -50,6 +51,8 @@ define i32 @foo() noreturn { %lb = load i32* bitcast (i8* blockaddress(@foo, %next) to i32*) ; CHECK: Call to block address call void()* bitcast (i8* blockaddress(@foo, %next) to void()*)() +; CHECK: Undefined behavior: Null pointer dereference + call void @llvm.stackrestore(i8* null) br label %next |