[cfe-commits] r58554 - /cfe/trunk/test/Analysis/stack-addr-ps.c
Ted Kremenek
kremenek at apple.com
Sat Nov 1 17:37:31 PDT 2008
Author: kremenek
Date: Sat Nov 1 19:37:31 2008
New Revision: 58554
URL: http://llvm.org/viewvc/llvm-project?rev=58554&view=rev
Log:
Add 'alloca' test case for return-of-stack-address checker.
Modified:
cfe/trunk/test/Analysis/stack-addr-ps.c
Modified: cfe/trunk/test/Analysis/stack-addr-ps.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/stack-addr-ps.c?rev=58554&r1=58553&r2=58554&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/stack-addr-ps.c (original)
+++ cfe/trunk/test/Analysis/stack-addr-ps.c Sat Nov 1 19:37:31 2008
@@ -1,5 +1,7 @@
// RUN: clang -checker-simple -verify %s
+#include <stdlib.h>
+
int* f1() {
int x = 0;
return &x; // expected-warning{{Address of stack memory associated with local variable 'x' returned.}} expected-warning{{address of stack memory associated with local variable 'x' returned}}
@@ -33,3 +35,8 @@
return p; // expected-warning{{Address of stack memory}}
}
+void* alloca_test() {
+ void* p = alloca(10);
+ return p; // expected-warning{{Address of stack memory}}
+}
+
More information about the cfe-commits
mailing list