aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa/ipa-sra-7.c
blob: 921334a4fd8019bec001bab8e8dd50a9f72b8049 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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;
}