]> git.sur5r.net Git - cc65/blob - test/ref/cc65090913.c
remote TABs in doc/ and test/
[cc65] / test / ref / cc65090913.c
1 /*
2   !!DESCRIPTION!! optimizer bug
3   !!ORIGIN!!      testsuite
4   !!LICENCE!!     Public Domain
5   !!AUTHOR!!      Oliver Schmidt
6 */
7
8 /*
9 > I found the problem and fixed it. cc65 treated a label as a statement, but
10 > the standard says, that a label is part of a statement. In a loop without
11 > curly braces like
12 >
13 >         while (foo < bar)
14 >             label:  ++foo;
15 >
16 > the following statement is the one that is looped over - and because cc65
17 > treated just the label as a statement, it created code that looped forever.
18
19 */
20
21 #include <stdio.h>
22
23 int foo=0,bar=2;
24
25 int main(void)
26 {
27     while(foo<bar)
28             label: ++foo;
29
30     printf("foo: %d bar: %d\n",foo,bar);
31
32     return 0;
33 }