Fix ICE in substring-handling building 502.gcc_r (PR 87562)
[official-gcc.git] / gcc / testsuite / gcc.dg / union-5.c
blobea65f4b0273f7e53833058a0906613723b245f6b
1 /* { dg-do run { target i?86-*-* x86_64-*-* } } */
2 /* { dg-options "-O -fgcse -fno-split-wide-types" } */
4 extern void abort(void);
6 typedef unsigned short int uint16_t;
7 typedef unsigned int uint32_t;
8 typedef unsigned long long uint64_t;
10 typedef struct
12 uint16_t thread;
13 uint16_t phase;
14 } s32;
16 typedef union
18 uint32_t i;
19 s32 s;
20 } u32;
22 typedef union
24 uint64_t i;
25 u32 u;
26 } u64;
28 static __attribute__((noinline))
29 void foo(int val)
31 u64 data;
32 uint32_t thread;
34 data.u.i = 0x10000L;
35 thread = data.u.s.thread;
36 if (val)
37 abort ();
38 if (thread)
39 abort ();
42 int main(void)
44 foo (0);
45 return 0;