diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/ipa/ipa-sra-7.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/ipa/ipa-sra-7.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-7.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-7.c new file mode 100644 index 0000000000..921334a4fd --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-7.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3" } */ + +typedef unsigned int myint __attribute__((aligned(1))); + +typedef struct __attribute__((packed)) S { + unsigned a, b, c; +} SS; + +typedef SS __attribute__((aligned(1))) SSS; + + +static unsigned int __attribute__ ((noinline)) +get_a (SSS *p) +{ + return p->a; +}; + +static int __attribute__ ((noinline, noclone)) +foo (SS *p) +{ + int r = (int) get_a(p) + 2; + return r; +} + +char buf[512]; + +static SSS * __attribute__ ((noinline, noclone)) +get_sss (void) +{ + return (SSS *)(buf + 1); +} + + +int +main(int argc, char *argv[]) +{ + SSS *p = get_sss(); + if (foo(p) != 2) + __builtin_abort (); + return 0; +} |