2014-09-24 14:45:10 +00:00
|
|
|
/*
|
|
|
|
!!DESCRIPTION!! optimizer bug
|
|
|
|
!!ORIGIN!! testsuite
|
|
|
|
!!LICENCE!! Public Domain
|
|
|
|
!!AUTHOR!! Oliver Schmidt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
> I found the problem and fixed it. cc65 treated a label as a statement, but
|
|
|
|
> the standard says, that a label is part of a statement. In a loop without
|
|
|
|
> curly braces like
|
|
|
|
>
|
|
|
|
> while (foo < bar)
|
|
|
|
> label: ++foo;
|
|
|
|
>
|
|
|
|
> the following statement is the one that is looped over - and because cc65
|
|
|
|
> treated just the label as a statement, it created code that looped forever.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2014-11-22 17:28:05 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2014-09-24 14:45:10 +00:00
|
|
|
int foo=0,bar=2;
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
while(foo<bar)
|
2019-02-12 21:50:49 +00:00
|
|
|
label: ++foo;
|
2014-09-24 14:45:10 +00:00
|
|
|
|
|
|
|
printf("foo: %d bar: %d\n",foo,bar);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|