60 lines · c
1// RUN: %clang_cc1 %s -emit-llvm -o -2 3union u_tag {4 int a;5 float b;6} u;7 8void f(void) {9 u.b = 11;10}11 12float get_b(union u_tag *my_u) {13 return my_u->b;14}15 16int f2( float __x ) { 17 union{ 18 float __f; 19 unsigned int __u; 20 }__u;21 return (int)(__u.__u >> 31); 22}23 24typedef union { int i; int *j; } value;25 26int f3(value v) {27 return *v.j;28}29 30enum E9 { one, two };31union S65 { enum E9 a; } ; union S65 s65;32void fS65(void) { enum E9 e = s65.a; } 33 34typedef union{35 unsigned char x[65536];36} q;37void qfunc(void) {q buf; unsigned char* x = buf.x;}38 39union RR {_Bool a : 1;} RRU;40int RRF(void) {return RRU.a;}41 42// PR616443typedef union T0 { unsigned int : 0; } T0;44T0 t0;45 46union { int large_bitfield: 31; char c } u2;47 48struct dt_t_s {49 union {50 long long u : 56;51 } __attribute__((packed));52};53struct {54 struct {55 struct {56 struct dt_t_s t;57 };58 };59} a;60