aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/i386/pr40718.c
blob: 1df3548e0ec9647a0c502bb5a088de3036cd38b0 (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
/* { dg-do run } */
/* { dg-require-effective-target ia32 } */
/* { dg-options "-O1 -foptimize-sibling-calls" } */

void abort (void);

struct S
{
  void (__attribute__((__stdcall__)) *f) (struct S *);
  int i;
};

void __attribute__((__stdcall__))
foo (struct S *s)
{
  s->i++;
}

void __attribute__((__stdcall__))
bar (struct S *s)
{
  foo(s);
  s->f(s);
}

int main (void)
{
  struct S s = { foo, 0 };

  bar (&s);
  if (s.i != 2)
    abort ();

  return 0;
}