aboutsummaryrefslogtreecommitdiff
path: root/test/Other
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-05-28 04:33:42 +0000
committerDan Gohman <gohman@apple.com>2010-05-28 04:33:42 +0000
commit292fc87fe2f1611e7c83a61796ab71db6a0f7d97 (patch)
tree8344299ed3991fdb6d170614ef35555d0edc10f3 /test/Other
parent28d2e0a39fb0dccb62a08520791070d13339d6e1 (diff)
Add a lint check for returning the address of stack memory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104936 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Other')
-rw-r--r--test/Other/lint.ll7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/Other/lint.ll b/test/Other/lint.ll
index 1f9efe3ad9..d0d3c7e186 100644
--- a/test/Other/lint.ll
+++ b/test/Other/lint.ll
@@ -97,3 +97,10 @@ define void @use_tail(i8* %valist) {
tail call void @tailcallee(i8* %s)
ret void
}
+
+; CHECK: Unusual: Returning alloca or va_arg value
+define i8* @return_local(i32 %n, i32 %m) {
+ %t = alloca i8, i32 %n
+ %s = getelementptr i8* %t, i32 %m
+ ret i8* %s
+}