Debian Codegraph @

gcc/testsuite/gcc.dg/analyzer/compound-assignment-3.c

raw
1 #include <stdlib.h>
2
3 struct union_wrapper
4 {
5 union
6 {
7 int i;
8 void *ptr;
9 } u;
10 };
11
12 struct union_wrapper
13 test_1 (void)
14 {
15 struct union_wrapper uw1;
16 uw1.u.ptr = malloc (1024);
17 return uw1;
18 }
19
20 struct union_wrapper
21 test_2 (void)
22 {
23 struct union_wrapper uw2;
24 uw2.u.ptr = malloc (1024);
25 } /* { dg-warning "leak of 'uw2.u.ptr'" } */