aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/compound-assignment-3.c
blob: 49259262c4affc6f313ccf176e0bb9f0e4f92c90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdlib.h>

struct union_wrapper
{
  union
  {
    int i;
    void *ptr;
  } u;
};

struct union_wrapper
test_1 (void)
{
  struct union_wrapper uw1;
  uw1.u.ptr = malloc (1024);
  return uw1;
}

struct union_wrapper
test_2 (void)
{
  struct union_wrapper uw2;
  uw2.u.ptr = malloc (1024);
} /* { dg-warning "leak of 'uw2.u.ptr'" } */