]> git.sur5r.net Git - cc65/blob - test/val/cc65141022.c
goto.c warning fix for implicit truncation
[cc65] / test / val / cc65141022.c
1
2 /*
3   !!DESCRIPTION!! struct base address dereferencing bug
4   !!ORIGIN!!      Testsuite
5   !!LICENCE!!     Public Domain
6 */
7
8 #include <stdlib.h>
9 #include <stdio.h>
10
11 struct yywork
12 {
13         char verify, advance;
14 } yycrank[] =
15 {
16         {0,0}
17 };
18
19 struct yysvf
20 {
21         struct yywork *yystoff;
22 } yysvec[1];
23
24 unsigned char fails = 0;
25
26 int main(int n, char **args)
27 {
28     struct yysvf *yystate = yysvec;
29     struct yywork *yyt;
30
31     yystate->yystoff = yycrank;
32     yyt = yystate->yystoff;
33
34     if(yyt == yycrank) {
35         printf("yyt == yycrank (ok)\n");
36     } else {
37         printf("yyt != yycrank (fail)\n");
38         ++fails;
39     }
40
41     if(yyt == yystate->yystoff) {
42         printf("yyt == yystate->yystoff (ok)\n");
43     } else {
44         printf("yyt != yystate->yystoff (fail)\n");
45         ++fails;
46     }
47
48     if(yycrank == yystate->yystoff) {
49         printf("yycrank == yystate->yystoff (ok)\n");
50     } else {
51         printf("yycrank != yystate->yystoff (fail)\n");
52         ++fails;
53     }
54
55     printf("fails: %d\n", fails);
56     return fails;
57 }