From: Ted Kremenek Date: Fri, 31 Oct 2008 00:19:42 +0000 (+0000) Subject: Enhance compound literal test case. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fab6f220cdbcd7269d8f6e19988774efe0a49983;p=clang Enhance compound literal test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58480 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Analysis/stack-addr-ps.c b/test/Analysis/stack-addr-ps.c index 7eead3bb20..a95cb6bb89 100644 --- a/test/Analysis/stack-addr-ps.c +++ b/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; }