diff options
| -rw-r--r-- | clang/test/Analysis/stack-addr-ps.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/Analysis/stack-addr-ps.c b/clang/test/Analysis/stack-addr-ps.c index bc046cd7135..2173cac0c45 100644 --- a/clang/test/Analysis/stack-addr-ps.c +++ b/clang/test/Analysis/stack-addr-ps.c @@ -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 @@ void* compound_literal(int x, int y) { return p; // expected-warning{{Address of stack memory}} } +void* alloca_test() { + void* p = alloca(10); + return p; // expected-warning{{Address of stack memory}} +} + |

