diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/torture/pr25654.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr25654.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr25654.c b/gcc/testsuite/gcc.dg/torture/pr25654.c new file mode 100644 index 000000000..03761e93c --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr25654.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ + +extern void abort (void) __attribute__((noreturn)); + +union setconflict +{ + short a[20]; + int b[10]; +}; + +int +main () +{ + int sum = 0; + { + union setconflict a; + short *c; + c = a.a; + asm ("": "=r" (c):"0" (c)); + *c = 0; + asm ("": "=r" (c):"0" (c)); + sum += *c; + } + { + union setconflict a; + int *c; + c = a.b; + asm ("": "=r" (c):"0" (c)); + *c = 1; + asm ("": "=r" (c):"0" (c)); + sum += *c; + } + + if (sum != 1) + abort(); + return 0; +} |