1 /* Make sure that by reference and by value aggregate jump functions do not get 2 mixed up. 3 ??? This testcase is invalid C and can only pass on specific platforms. */ 4 /* { dg-lto-do run } */ 5 /* { dg-skip-if "" { { sparc*-*-* } && ilp32 } { "*" } { "" } } */ 6 /* { dg-lto-options { {-O3 -fno-early-inlining -flto -Wno-lto-type-mismatch}} } */ 7 8 extern void abort (void); 9 10 struct S 11 { 12 int i; 13 void (*f)(struct S *); 14 int j; 15 }; 16 17 struct E 18 { 19 struct S *p; 20 }; 21 22 struct S *gs; 23 int gr = 111; 24 char gc[1024]; 25 26 static __attribute__ ((noinline, noclone)) struct S * get_s(void)27get_s (void) 28 { 29 return (struct S *) &gc; 30 } 31 wrong_target(struct S * s)32static void wrong_target (struct S *s) 33 { 34 abort (); 35 } 36 bar(struct S * s)37void bar (struct S *s) 38 { 39 s->f (s); 40 } 41 42 extern void foo (struct S *s); 43 main(int argc,char ** argv)44int main (int argc, char **argv) 45 { 46 struct S *s = get_s(); 47 gs = s; 48 s->i = 5678; 49 s->f = wrong_target; 50 s->j = 1234; 51 foo (s); 52 53 return gr; 54 } 55