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