]> granicus.if.org Git - clang/commitdiff
Enhance compound literal test case.
authorTed Kremenek <kremenek@apple.com>
Fri, 31 Oct 2008 00:19:42 +0000 (00:19 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 31 Oct 2008 00:19:42 +0000 (00:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58480 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/stack-addr-ps.c

index 7eead3bb20dc7612c6e814cb333ade95529e6012..a95cb6bb892c2076a852d963380e2e9bc447e2d7 100644 (file)
@@ -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;
 }