Fix zero_ext documentation
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / nodebug.c
... / ...
CommitLineData
1#include <stdlib.h>
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
9int
10inner (int x)
11{
12 return x + dataglobal + datalocal + bssglobal + bsslocal;
13}
14
15static short
16middle (int x)
17{
18 return 2 * inner (x);
19}
20
21short
22top (int x)
23{
24 return 2 * middle (x);
25}
26
27int
28main (int argc, char **argv)
29{
30 return top (argc);
31}
32
33int *x;
34
35int array_index (char *arr, int i)
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 0.026078 seconds and 4 git commands to generate.