PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / ipa / ipa-sra-7.c
blob921334a4fd8019bec001bab8e8dd50a9f72b8049
1 /* { dg-do run } */
2 /* { dg-options "-O3" } */
4 typedef unsigned int myint __attribute__((aligned(1)));
6 typedef struct __attribute__((packed)) S {
7 unsigned a, b, c;
8 } SS;
10 typedef SS __attribute__((aligned(1))) SSS;
13 static unsigned int __attribute__ ((noinline))
14 get_a (SSS *p)
16 return p->a;
19 static int __attribute__ ((noinline, noclone))
20 foo (SS *p)
22 int r = (int) get_a(p) + 2;
23 return r;
26 char buf[512];
28 static SSS * __attribute__ ((noinline, noclone))
29 get_sss (void)
31 return (SSS *)(buf + 1);
35 int
36 main(int argc, char *argv[])
38 SSS *p = get_sss();
39 if (foo(p) != 2)
40 __builtin_abort ();
41 return 0;