1202719Sgabor/* Copyright (C) 2008-2020 Free Software Foundation, Inc.
2202719Sgabor
3202719Sgabor   This program is free software; you can redistribute it and/or modify
4202719Sgabor   it under the terms of the GNU General Public License as published by
5202719Sgabor   the Free Software Foundation; either version 3 of the License, or
6202719Sgabor   (at your option) any later version.
7202719Sgabor
8202719Sgabor   This program is distributed in the hope that it will be useful,
9202719Sgabor   but WITHOUT ANY WARRANTY; without even the implied warranty of
10202719Sgabor   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11202719Sgabor   GNU General Public License for more details.
12202719Sgabor
13202719Sgabor   You should have received a copy of the GNU General Public License
14202719Sgabor   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
15202719Sgabor
16202719Sgabor/* This is only ever run if it is compiled with a new-enough GCC, but
17202719Sgabor   we don't want the compilation to fail if compiled by some other
18202719Sgabor   compiler.  */
19202719Sgabor#ifdef __GNUC__
20202719Sgabor#define ATTR __attribute__((always_inline))
21202719Sgabor#else
22202719Sgabor#define ATTR
23202719Sgabor#endif
24202719Sgabor
25202719Sgaborint x, y;
26202719Sgaborvolatile int z = 0;
27202719Sgaborvolatile int result;
28202719Sgabor
29202719Sgaborvoid bar(void);
30202719Sgaborvoid marker(void);
31202719Sgaborvoid noinline(void);
32202719Sgabor
33202719Sgaborinline ATTR int func1(void)
34202719Sgabor{
35202719Sgabor  bar ();
36202719Sgabor  return x * y;
37202719Sgabor}
38202719Sgabor
39202719Sgaborinline ATTR int func2(void)
40202719Sgabor{
41202719Sgabor  return x * func1 ();
42227163Sed}
43202719Sgabor
44227163Sedinline ATTR void func3(void)
45202719Sgabor{
46202719Sgabor  bar ();
47202719Sgabor}
48202719Sgabor
49202719Sgaborinline ATTR void outer_inline1(void)
50202719Sgabor{
51202719Sgabor  noinline ();
52202719Sgabor}
53202719Sgabor
54202719Sgaborinline ATTR void outer_inline2(void)
55202719Sgabor{
56202719Sgabor  outer_inline1 ();
57202719Sgabor}
58202719Sgabor
59202719Sgaborint main (void)
60202719Sgabor{ /* start of main */
61202719Sgabor  int val;
62203443Sgabor
63203443Sgabor  x = 7;
64202719Sgabor  y = 8; /* set mi break here */
65202719Sgabor
66202719Sgabor  result = func1 ();
67202719Sgabor  result = func2 ();
68202719Sgabor  marker ();
69202719Sgabor
70202719Sgabor  result = 0;
71202719Sgabor  result = 0; /* set breakpoint 3 here */
72202719Sgabor
73202719Sgabor  func1 (); /* first call */
74202719Sgabor  func1 (); /* second call */
75202719Sgabor  marker ();
76202719Sgabor
77202719Sgabor  result = 0;
78202719Sgabor  result = 0; /* set breakpoint 4 here */
79202719Sgabor
80202719Sgabor  func1 ();
81202719Sgabor  func3 ();
82202719Sgabor  marker ();
83203443Sgabor
84203443Sgabor  result = 0;
85202719Sgabor  result = 0; /* set breakpoint 5 here */
86202719Sgabor
87202719Sgabor  marker ();
88202719Sgabor  func1 ();
89202719Sgabor  func3 ();
90208974Sgabor  marker ();  /* set breakpoint 6 here */
91208867Sgabor
92202719Sgabor  outer_inline2 ();
93202719Sgabor
94202719Sgabor  return 0;
95202719Sgabor}
96202719Sgabor