PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / ipa / ipa-sra-9.c
blobc5468cfbb76aa1b18569555e044525d71c01327d
1 /* { dg-do run } */
2 /* { dg-options "-O3" } */
4 typedef unsigned int myint __attribute__((aligned(1)));
6 typedef struct S {
7 unsigned a, b, c;
8 } SS;
10 typedef struct U {
11 SS s[2];
12 } UU;
14 typedef UU __attribute__((aligned(1))) UUU;
16 static unsigned int __attribute__ ((noinline))
17 get_a (SS s)
19 return s.a;
22 static int __attribute__ ((noinline, noclone))
23 foo (UUU *p)
25 int r = (int) get_a(p->s[0]) + 2;
26 return r;
29 char buf[512];
31 static UUU * __attribute__ ((noinline, noclone))
32 get_uuu (void)
34 return (UUU *)(buf + 1);
37 int
38 main(int argc, char *argv[])
40 UUU *p = get_uuu();
41 if (foo(p) != 2)
42 __builtin_abort ();
43 return 0;