summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/compile/pr42025-2.c
blob: 14cb36d1c0e1c184a3f88bd3f01df14fe3a6ac9b (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
26
27
28
29
30
31
32
typedef struct
{
  void *p;
} Ptr;

struct A
{
  int i;
  union
  {
    Ptr p;
    char *q;
  } u;
};

extern Ptr get_stuff (void);
extern void use_stuff (char *);

static void foo(struct A p, char *q)
{
  if (p.i)
    p.u.p = get_stuff ();
  else
    p.u.q = q;

  use_stuff (p.u.q);
}

void bar(struct A *p, char *q)
{
  foo(*p, q);
}