Re: [cc65] Optimizer bug found

From: Groepaz <groepaz1gmx.net>
Date: 2009-09-14 00:10:07
On Sonntag 13 September 2009, Ullrich von Bassewitz wrote:
> 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.

great its fixed! i added another seperate test for this, and rerun everything 
on 4168 - all fine.

BUT: yacc.c shows still same behaviour (works without optimizations, doesnt 
work with them. always works with debug output enabled). this is kinda 
weird.... hrm. weird because, the charset-translation related problems should 
not matter when i run the testsuite (because the little library i compiled 
for my cpu simulator uses regular ascii, and tests are compiled for 
the "none" target). *shrug*

> This was really a tough one. yacc.c is one of the worst program I've seen
> in years. After fixing the bug in the compiler, I've spent more than an
> hour to verify that all other problems are in yacc.c - because the
> behaviour changed, but it still did not run.

=P i have spent a night fiddling with the damn thing too :/

> Not only line feeds are hardcoded, the program is somehow using char codes
> instead of numeric constants. I had to replace the 'A' character literals
> in the table by their ASCII code (0x41) to make the program work. With the
> cc65 character translation in place, 0xC1 was used instead, which broke the
> program logic somehow.

seems like you somehow missed by mail from friday:

"and about the damned yacc.c program: WARNING! :) it contains hardcoded 10's 
for checking line-endings, so it wont work when eg compiled for c64 and then 
using a proper petscii file as input. (and it might have worked before, only 
because i didnt convert the input files to proper petscii =P) i am trying to 
change such things right now to make the program portable in that respect ..."

:) i thought i had fixed the charset releated stuff in my version, but doesnt 
seem so...mpf

> So if you want to keep the program in the test suite
> (which is a good idea), you will have to fix at least the most unportable
> things. I can send you my working version, which has also improved debug
> output.

yes, please mail it over :) also please include the exact input file you have 
been using (you can never know...)

i would really like to keep a proper working version of yacc.c in the 
testsuite... its exactly the kind of program that tortures a compiler a bit 
=)

-- 

http://www.hitmen-console.org    http://magicdisk.untergrund.net
http://www.pokefinder.org        http://ftp.pokefinder.org

No one can earn a million dollars honestly. 
<William Jennings Bryan>

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Sep 14 00:10:22 2009

This archive was generated by hypermail 2.1.8 : 2009-09-14 00:10:24 CEST