1/* This testcase is part of GDB, the GNU debugger. 2 3 Copyright 2004 Free Software Foundation, Inc. 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 19*/ 20 21/* Useful abreviations. */ 22typedef void t; 23typedef char tc; 24typedef short ts; 25typedef int ti; 26typedef long tl; 27typedef long long tll; 28typedef float tf; 29typedef double td; 30typedef long double tld; 31typedef enum { e = '1' } te; 32 33/* Force the type of each field. */ 34#ifndef T 35typedef t T; 36#endif 37 38T foo = '1', L; 39 40T fun() 41{ 42 return foo; 43} 44 45#ifdef PROTOTYPES 46void Fun(T foo) 47#else 48void Fun(foo) 49 T foo; 50#endif 51{ 52 L = foo; 53} 54 55zed () 56{ 57 L = 'Z'; 58} 59 60int main() 61{ 62#ifdef usestubs 63 set_debug_traps(); 64 breakpoint(); 65#endif 66 int i; 67 68 Fun(foo); 69 70 /* An infinite loop that first clears all the variables and then 71 calls the function. This "hack" is to make re-testing easier - 72 "advance fun" is guaranteed to have always been preceeded by a 73 global variable clearing zed call. */ 74 75 zed (); 76 while (1) 77 { 78 L = fun (); 79 zed (); 80 } 81 82 return 0; 83} 84