1 /* Test program for stack trace through noreturn function.
2 
3    Copyright 2003 Free Software Foundation, Inc.
4 
5    This file is part of the gdb testsuite.
6 
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11 
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 59 Temple Place - Suite 330,
20    Boston, MA 02111-1307, USA.
21 
22    This file was written by Michael Elizabeth Chastain (mec@shout.net).  */
23 
24 #include <stdlib.h>
25 
26 int global = 0;
27 
28 /* Foo, gcc thinks 'gamma' is a reserved identifier.
29    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12213
30    I am not interested in testing that point so just avoid the word.
31    -- chastain 2003-09-08. */
32 void my_gamma (int *parray)
33 {
34   return;
35 }
36 
37 void beta ()
38 {
39   int array [4];
40   array [0] = global++;
41   array [1] = global++;
42   array [2] = global++;
43   array [3] = global++;
44   my_gamma (array);
45   abort ();
46 }
47 
48 int alpha ()
49 {
50   global++;
51   beta ();
52   return 0;
53 }
54 
55 int main ()
56 {
57   int i;
58   global++;
59   i = alpha ();
60   return i;
61 }
62