summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/pr12329.c
blob: 601480c028365f3bfc17f2a433611a9f839b9399 (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
43
44
45
46
47
/* { dg-do run } */
/* { dg-require-effective-target ilp32 } */
/* { dg-options "-O2" } */

extern void abort (void);

int test_nested1 (int i)
{
  int __attribute__ ((__noinline__, __regparm__(3))) foo(int j, int k, int l)
  {
    return i + j + k + l;
  }

  return foo (i, i+1, i+2);
}

int test_nested2 (int i)
{
  int x;

  int __attribute__ ((__noinline__, __regparm__(3))) foo(int j, int k, int l)
  {
    return i + j + k + l;
  }

  x = foo (i+3, i+1, i+2);
  if (x != (4*i + 6))
    abort ();

  return x;
}

int
main ()
{
  int i = test_nested1 (3);

  if (i != 15)
    abort ();

  i = test_nested2 (4);

  if (i != 22)
    abort ();

  return 0;
}