libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / nested-func-12.c
blobd617d7e4487393f276788f8a1d572a410c242365
1 /* PR target/88620 */
2 /* { dg-do run } */
3 /* { dg-options "-Ofast --param ipa-cp-eval-threshold=0 -fno-guess-branch-probability -fno-inline-small-functions" } */
4 /* { dg-require-effective-target alloca } */
6 void
7 foo (int n)
9 struct S { int a[n]; };
11 struct S
12 fn (void)
14 struct S s;
15 s.a[0] = 42;
16 return s;
19 auto struct S
20 fn2 (void)
22 return fn ();
25 struct S x;
26 fn ();
27 fn2 ();
28 x = fn ();
30 if (x.a[0] != 42)
31 __builtin_abort ();
33 if (fn ().a[0] != 42)
34 __builtin_abort ();
36 __typeof__ (fn ()) *p = &x;
37 if (p->a[0] != 42)
38 __builtin_abort ();
40 if (fn2 ().a[0] != 42)
41 __builtin_abort ();
44 int
45 main (void)
47 foo (1);