Fix zero_ext documentation
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / nodebug.c
CommitLineData
085dd6e6 1#include <stdlib.h>
c906108c
SS
2/* Test that things still (sort of) work when compiled without -g. */
3
4int dataglobal = 3; /* Should go in global data */
5static int datalocal = 4; /* Should go in local data */
6int bssglobal; /* Should go in global bss */
7static int bsslocal; /* Should go in local bss */
8
085dd6e6
JM
9int
10inner (int x)
c906108c
SS
11{
12 return x + dataglobal + datalocal + bssglobal + bsslocal;
13}
14
085dd6e6
JM
15static short
16middle (int x)
c906108c
SS
17{
18 return 2 * inner (x);
19}
20
085dd6e6
JM
21short
22top (int x)
c906108c
SS
23{
24 return 2 * middle (x);
25}
26
085dd6e6
JM
27int
28main (int argc, char **argv)
c906108c 29{
c906108c
SS
30 return top (argc);
31}
32
c906108c
SS
33int *x;
34
085dd6e6 35int 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}
This page took 3.094592 seconds and 4 git commands to generate.