fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / libgloss / testsuite / libgloss.all / math.c
blobfe137dab12a3318c42093172881308d6699f52ba
1 /* Oki bug report [OKI004](gcc005)
3 The following computation is no work.
4 -1 / 1 => 1 (correct -1)
5 -1 % 2 => 1 (correct -1)
6 */
8 #include <stdio.h>
10 main ()
12 long l1, l2, l6;
13 auto long l3;
14 long oza1, oza2, oza;
16 l1 = 1;
17 l2 = 2;
18 l3 = -1;
19 l6 = 6;
21 /*** test 1 ***/
22 oza = ((l3 / ((l1)--)) | (l6 <= (l3 % l2)));
23 printf ("test 1 has a result of %d.\n", oza);
24 if (oza != -1)
25 fail ("divide test [OKI004]");
26 else
27 pass ("divide test [OKI004]");
29 l1 = 1;
30 /*** test 2 ***/
31 oza1 = (l3 / ((l1)--));
32 oza2 = (l6 <= (l3 % l2));
33 oza = oza1 | oza2;
35 printf ("test 2 has a result of %d.\n", oza);
36 if (oza != -1)
37 fail ("modulos test [OKI004]");
38 else
39 pass ("modulos test [OKI004]");
40 fflush (stdout);
42 test_1();
46 32760 / (1) = 32760
47 32760 / (-1) = 32760 -------> ERROR, same as you said.
48 32760 / (2) = 16380
49 32760 / (-2) = -2147467268 ----> ERROR
50 32760 / (3) = 10920
51 32760 / (-3) = -1431644845 ----> ERROR
52 32760 / (4) = 8190
53 32760 / (-4) = -8190
55 test_1()
57 int value, i, j;
59 i = 32760;
60 j = 1;
61 value = i / (j);
62 printf ("%d / (%d) = %d\n", i, j, value);
63 j = -1;
64 value = i / (j);
65 printf ("%d / (%d) = %d\n", i, j, value);
67 j = 2;
68 value = i / (j);
69 printf ("%d / (%d) = %d\n", i, j, value);
70 j = -2;
71 value = i / (j);
72 printf ("%d / (%d) = %d\n", i, j, value);
74 j = 3;
75 value = i / (j);
76 printf ("%d / (%d) = %d\n", i, j, value);
77 j = -3;
78 value = i / (j);
79 printf ("%d / (%d) = %d\n", i, j, value);
81 j = 4;
82 value = i / (j);
83 printf ("%d / (%d) = %d\n", i, j, value);
84 j = -4;
85 value = i / (j);
86 printf ("%d / (%d) = %d\n", i, j, value);