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 test_1(void)13test_1 (void) 14 { 15 struct union_wrapper uw1; 16 uw1.u.ptr = malloc (1024); 17 return uw1; 18 } 19 20 struct union_wrapper test_2(void)21test_2 (void) 22 { 23 struct union_wrapper uw2; 24 uw2.u.ptr = malloc (1024); 25 } /* { dg-warning "leak of '\\(void \\*\\)uw2.u'" } */ 26