summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/stack-addr-ps.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-10-31 00:19:42 +0000
committerTed Kremenek <kremenek@apple.com>2008-10-31 00:19:42 +0000
commit20cf431bcebe47cb7440f7769c8450828318607b (patch)
treecc86df1c5bde1ca7f94dc28995a778074389cc5a /clang/test/Analysis/stack-addr-ps.c
parent289c37ad8d2098a472f38105f9d0be754401221a (diff)
downloadbcm5719-llvm-20cf431bcebe47cb7440f7769c8450828318607b.tar.gz
bcm5719-llvm-20cf431bcebe47cb7440f7769c8450828318607b.zip
Enhance compound literal test case.
llvm-svn: 58480
Diffstat (limited to 'clang/test/Analysis/stack-addr-ps.c')
-rw-r--r--clang/test/Analysis/stack-addr-ps.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/test/Analysis/stack-addr-ps.c b/clang/test/Analysis/stack-addr-ps.c
index 7eead3bb20d..a95cb6bb892 100644
--- a/clang/test/Analysis/stack-addr-ps.c
+++ b/clang/test/Analysis/stack-addr-ps.c
@@ -18,12 +18,18 @@ int* f3(int x, int *y) {
return y; // expected-warning{{Address of stack memory associated with local variable 'w' returned.}}
}
-void* compound_literal(int x) {
+void* compound_literal(int x, int y) {
if (x)
return &(unsigned short){((unsigned short)0x22EF)}; // expected-warning{{Address of stack memory}} expected-warning{{braces around scalar initializer}}
int* array[] = {};
struct s { int z; double y; int w; };
- return &((struct s){ 2, 0.4, 5 * 8 }); // expected-warning{{Address of stack memory}}
+
+ if (y)
+ return &((struct s){ 2, 0.4, 5 * 8 }); // expected-warning{{Address of stack memory}}
+
+
+ void* p = &((struct s){ 42, 0.4, x ? 42 : 0 });
+ return p;
}
OpenPOWER on IntegriCloud