1 #include <stdlib.h>
2 
3 union
4 {
5   void *ptr_val;
6   int int_val;
7 } global_union;
8 
test_1(void)9 void test_1 (void)
10 {
11   global_union.ptr_val = malloc (1024);
12 }
13 
test_2(void)14 void test_2 (void)
15 {
16   global_union.ptr_val = malloc (1024); /* { dg-message "allocated here" } */
17   global_union.int_val = 0;
18 } /* { dg-warning "leak of '<unknown>' " } */
19 /* TODO: something better than "<unknown>".  */
20 /* TODO: better location for the leak.  */
21 
22