2000-12-07 Michael Snyder <msnyder@cleaver.cygnus.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / return2.c
CommitLineData
efb66345
MS
1/* Test gdb's "return" command. */
2
3int void_test = 0;
4int main_test = 0;
5
6char char_returnval = '1';
7short short_returnval = 1;
8int int_returnval = 1;
9long long_returnval = 1;
10long long long_long_returnval = 1;
11float float_returnval = 1;
12double double_returnval = 1;
13
14union {
15 char char_testval;
16 short short_testval;
17 int int_testval;
18 long long_testval;
19 long long long_long_testval;
20 float float_testval;
21 double double_testval;
22 char ffff[80];
23} testval;
24
25void void_func ()
26{
27 void_test = 1;
28}
29
30char char_func ()
31{
32 return char_returnval;
33}
34
35short short_func ()
36{
37 return short_returnval;
38}
39
40int int_func ()
41{
42 return int_returnval;
43}
44
45long long_func ()
46{
47 return long_returnval;
48}
49
50long long long_long_func ()
51{
52 return long_long_returnval;
53}
54
55float float_func ()
56{
57 return float_returnval;
58}
59
60double double_func ()
61{
62 return double_returnval;
63}
64
65int main (int argc, char **argv)
66{
67 char char_resultval;
68 short short_resultval;
69 int int_resultval;
70 long long_resultval;
71 long long long_long_resultval;
72 float float_resultval;
73 double double_resultval;
74 int i;
75
76 /* A "test load" that will insure that the function really returns
77 a ${type} (as opposed to just a truncated or part of a ${type}). */
78 for (i = 0; i < sizeof (testval.ffff); i++)
79 testval.ffff[i] = 0xff;
80
81 void_func (); /* call to void_func */
82 char_resultval = char_func (); /* void_checkpoint */
83 short_resultval = short_func (); /* char_checkpoint */
84 int_resultval = int_func (); /* short_checkpoint */
85 long_resultval = long_func (); /* int_checkpoint */
86 long_long_resultval = long_long_func (); /* long_checkpoint */
87 float_resultval = float_func (); /* long_long_checkpoint */
88 double_resultval = double_func (); /* float_checkpoint */
89 main_test = 1; /* double_checkpoint */
90 return 0;
91}
This page took 0.025916 seconds and 4 git commands to generate.