summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr57425-1.c
blob: 8ca85cafe6de0b72841cff63abc4b0f253b4e7a1 (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
33
34
35
36
37
/* { dg-do run } */

extern void abort (void) __attribute__((noreturn));

union setconflict
{
  int a[20];
  long b[10];
};

int
main ()
{
  int sum = 0;
  {
    union setconflict a;
    int *c;
    c = a.a;
    asm ("": "=r" (c):"0" (c));
    *c = 0;
    asm ("": "=r" (c):"0" (c));
    sum += *c;
  }
  {
    union setconflict a;
    long *c;
    c = a.b;
    asm ("": "=r" (c):"0" (c));
    *c = 1;
    asm ("": "=r" (c):"0" (c));
    sum += *c;
  }

  if (sum != 1)
    abort();
  return 0;
}