summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/pr25654.c
blob: 2d7ef221f3cab92552e491b65a73c037ef28854a (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
38
39
40
41
42
/* { dg-do run } */
/* { dg-require-effective-target ilp32 } */
/* { dg-options "-O2 -mpreferred-stack-boundary=2 -march=i686 -frename-registers" } */

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

struct wrapper {
union setconflict
{
  short a[20];
  int b[10];
} a;
};

int
main ()
{
  int sum = 0;
  {
    struct wrapper a;
    short *c;
    c = a.a.a;
    asm ("": "=r" (c):"0" (c));
    *c = 0;
    asm ("": "=r" (c):"0" (c));
    sum += *c;
  }
  {
    struct wrapper a;
    int *c;
    c = a.a.b;
    asm ("": "=r" (c):"0" (c));
    *c = 1;
    asm ("": "=r" (c):"0" (c));
    sum += *c;
  }

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