1*e93f7393Sniklas /* Test that things still (sort of) work when compiled without -g. */ 2*e93f7393Sniklas 3*e93f7393Sniklas int dataglobal = 3; /* Should go in global data */ 4*e93f7393Sniklas static int datalocal = 4; /* Should go in local data */ 5*e93f7393Sniklas int bssglobal; /* Should go in global bss */ 6*e93f7393Sniklas static int bsslocal; /* Should go in local bss */ 7*e93f7393Sniklas 8*e93f7393Sniklas int 9*e93f7393Sniklas inner (x) 10*e93f7393Sniklas int x; 11*e93f7393Sniklas { 12*e93f7393Sniklas return x + dataglobal + datalocal + bssglobal + bsslocal; 13*e93f7393Sniklas } 14*e93f7393Sniklas 15*e93f7393Sniklas static short 16*e93f7393Sniklas middle (x) 17*e93f7393Sniklas int x; 18*e93f7393Sniklas { 19*e93f7393Sniklas return 2 * inner (x); 20*e93f7393Sniklas } 21*e93f7393Sniklas 22*e93f7393Sniklas short 23*e93f7393Sniklas top (x) 24*e93f7393Sniklas int x; 25*e93f7393Sniklas { 26*e93f7393Sniklas return 2 * middle (x); 27*e93f7393Sniklas } 28*e93f7393Sniklas 29*e93f7393Sniklas int 30*e93f7393Sniklas main (argc, argv) 31*e93f7393Sniklas int argc; 32*e93f7393Sniklas char **argv; 33*e93f7393Sniklas { 34*e93f7393Sniklas return top (argc); 35*e93f7393Sniklas } 36*e93f7393Sniklas 37*e93f7393Sniklas char *malloc (); 38*e93f7393Sniklas 39*e93f7393Sniklas int *x; 40*e93f7393Sniklas 41*e93f7393Sniklas int 42*e93f7393Sniklas array_index (arr, i) 43*e93f7393Sniklas char *arr; 44*e93f7393Sniklas int i; 45*e93f7393Sniklas { 46*e93f7393Sniklas /* The basic concept is just "return arr[i];". But call malloc so that gdb 47*e93f7393Sniklas will be able to call functions. */ 48*e93f7393Sniklas char retval; 49*e93f7393Sniklas x = (int *) malloc (sizeof (int)); 50*e93f7393Sniklas *x = i; 51*e93f7393Sniklas retval = arr[*x]; 52*e93f7393Sniklas free (x); 53*e93f7393Sniklas return retval; 54*e93f7393Sniklas } 55