]> git.sur5r.net Git - cc65/blob - test/ref/cc65110211.c
76b3f4a70fe582cdb3d6f99c9f5079b937e93110
[cc65] / test / ref / cc65110211.c
1 /*
2   !!DESCRIPTION!! unreachable code related bug
3   !!ORIGIN!!      Testsuite
4   !!LICENCE!!     Public Domain
5 */
6
7 /*
8     test2 and test3 will result in an endless loop (SVN version: 4974M)
9 */
10
11 #define OPENTEST()
12 #define CLOSETEST()
13
14 static char upper[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
15
16 int test1(void)
17 {
18     int res;
19     unsigned char *p;
20
21     p = upper;
22     res = 0;
23
24     while(*p) {
25         if(*p < 0) {
26             res = 1;
27         }
28         p++;
29     }
30
31     printf("test1:ok\n");
32     return res;
33 }
34
35 int test2(void)
36 {
37     int res;
38     unsigned char *p;
39
40     p = upper;
41     res = 0;
42
43     while(*p) {
44         if(*p++ < 0) {
45             res = 1;
46         }
47     }
48
49     printf("test2:ok\n");
50     return res;
51 }
52
53 int test3(void)
54 {
55     int res;
56     unsigned char *p;
57
58     p = upper;
59     res = 0;
60
61     while(*p) {
62         if(*++p < 0) {
63             res = 1;
64         }
65     }
66
67     printf("test3:ok\n");
68     return res;
69 }
70
71 int main(int n,char **args)
72 {
73     test1();
74     test2();
75     test3();
76
77     printf("it works :)\n");
78
79     return 0;
80 }