YA spurious-uninitialized-variable-warning test
[official-gcc.git] / gcc / libgcc1-test.c
blobd9c250e99d0087db359c0b16d6e6c12d0b69451f
1 /* This small function uses all the arithmetic operators that
2 libgcc1.c can handle. If you can link it, then
3 you have provided replacements for all the libgcc1.c functions that
4 your target machine needs. */
6 int foo ();
7 double dfoo ();
9 /* We don't want __main here because that can drag in atexit (among other
10 things) which won't necessarily exist yet. */
12 main_without__main ()
14 int a = foo (), b = foo ();
15 unsigned int au = foo (), bu = foo ();
16 float af = dfoo (), bf = dfoo ();
17 double ad = dfoo (), bd = dfoo ();
19 discard (a * b);
20 discard (a / b);
21 discard (a % b);
23 discard (au / bu);
24 discard (au % bu);
26 discard (a >> b);
27 discard (a << b);
29 discard (au >> bu);
30 discard (au << bu);
32 ddiscard (ad + bd);
33 ddiscard (ad - bd);
34 ddiscard (ad * bd);
35 ddiscard (ad / bd);
36 ddiscard (-ad);
38 ddiscard (af + bf);
39 ddiscard (af - bf);
40 ddiscard (af * bf);
41 ddiscard (af / bf);
42 ddiscard (-af);
44 discard ((int) ad);
45 discard ((int) af);
47 ddiscard ((double) a);
48 ddiscard ((float) a);
49 ddiscard ((float) ad);
51 discard (ad == bd);
52 discard (ad < bd);
53 discard (ad > bd);
54 discard (ad != bd);
55 discard (ad <= bd);
56 discard (ad >= bd);
58 discard (af == bf);
59 discard (af < bf);
60 discard (af > bf);
61 discard (af != bf);
62 discard (af <= bf);
63 discard (af >= bf);
65 return 0;
68 discard (x)
69 int x;
72 ddiscard (x)
73 double x;
76 foo ()
78 static int table[] = {20, 69, 4, 12};
79 static int idx;
81 return table[idx++];
84 double
85 dfoo ()
87 static double table[] = {20.4, 69.96, 4.4, 202.202};
88 static int idx;
90 return table[idx++];
93 /* Provide functions that some versions of the linker use to default
94 the start address if -e symbol is not used, to avoid the warning
95 message saying the start address is defaulted. */
96 extern void start() __asm__("start");
97 extern void _start() __asm__("_start");
98 extern void __start() __asm__("__start");
100 /* Provide functions that might be needed by soft-float emulation routines. */
101 void memcpy() {}
103 void start() {}
104 void _start() {}
105 void __start() {}
106 void mainCRTStartup() {}