summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.arch/amd64-entry-value.cc
blob: 44b7564c680fc917c27723ae174a4c9e40078de9 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/* This testcase is part of GDB, the GNU debugger.

   Copyright 2011 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

static volatile int v;

static void __attribute__((noinline, noclone))
e (int i, double j)
{
  v = 0;
}

static void __attribute__((noinline, noclone))
d (int i, double j)
{
  i++;
  j++;
  e (i, j);
  e (v, v);
asm ("breakhere:");
  e (v, v);
}

static void __attribute__((noinline, noclone))
c (int i, double j)
{
  d (i * 10, j * 10);
}

static void __attribute__((noinline, noclone))
a (int i, double j)
{
  c (i + 1, j + 1);
}

static void __attribute__((noinline, noclone))
b (int i, double j)
{
  c (i + 2, j + 2);
}

static void __attribute__((noinline, noclone))
amb_z (int i)
{
  d (i + 7, i + 7.5);
}

static void __attribute__((noinline, noclone))
amb_y (int i)
{
  amb_z (i + 6);
}

static void __attribute__((noinline, noclone))
amb_x (int i)
{
  amb_y (i + 5);
}

static void __attribute__((noinline, noclone))
amb (int i)
{
  if (i < 0)
    amb_x (i + 3);
  else
    amb_x (i + 4);
}

static void __attribute__((noinline, noclone))
amb_b (int i)
{
  amb (i + 2);
}

static void __attribute__((noinline, noclone))
amb_a (int i)
{
  amb_b (i + 1);
}

static void __attribute__((noinline, noclone)) self (int i);

static void __attribute__((noinline, noclone))
self2 (int i)
{
  self (i);
}

static void __attribute__((noinline, noclone))
self (int i)
{
  if (i == 200)
    {
      /* GCC would inline `self' as `cmovne' without the `self2' indirect.  */
      self2 (i + 1);
    }
  else
    {
      e (v, v);
      d (i + 2, i + 2.5);
    }
}

int
main ()
{
  d (30, 30.5);
  if (v)
    a (1, 1.25);
  else
    b (5, 5.25);
  amb_a (100);
  self (200);
  return 0;
}