1 /* { dg-do compile } */ 2 /* { dg-options "-O1" } */ 3 /* Let gimple verifier check what SRA does to unions and single-field 4 strucutres . */ 5 6 struct sim_struct 7 { 8 int x; 9 }; 10 11 extern struct sim_struct get_x(void); 12 foo(void)13struct sim_struct foo (void) 14 { 15 struct sim_struct simple; 16 17 simple = get_x (); 18 if (simple.x % 2) 19 simple.x = 39; 20 else 21 simple.x -=8; 22 23 return simple; 24 } 25 26 struct sim_cmplx 27 { 28 _Complex double c; 29 }; 30 31 extern struct sim_cmplx get_sc (void); 32 foo_c(void)33_Complex double foo_c (void) 34 { 35 struct sim_cmplx simple; 36 37 simple = get_sc (); 38 if (__real__ simple.c > 200.3) 39 __imag__ simple.c -= 2.4; 40 41 return simple.c; 42 } 43 44 45 union sim_union 46 { 47 int i; 48 float d; 49 }; 50 51 extern union sim_union get_y (void); 52 bar(void)53union sim_union bar (void) 54 { 55 union sim_union simple; 56 57 simple = get_y (); 58 if (simple.d > 8.2) 59 simple.i = 300; 60 61 return simple; 62 } 63 64 extern int get_int (void); 65 bar_i(void)66int bar_i (void) 67 { 68 union sim_union simple; 69 70 simple = get_y (); 71 if (simple.d > 8.2) 72 simple.i = get_int (); 73 74 return simple.i; 75 } 76