Re: [cc65] Bug(s) with -O/--static-locals?

From: Ullrich von Bassewitz <>
Date: 2010-11-02 19:12:03
Good evening!

On Tue, Nov 02, 2010 at 02:14:28AM +0200, Marc 'BlackJack' Rintsch wrote:
> When I turn on ``-O``: 58096 and 58096.  After swapping the two variable
> declaration lines in `calculate_checksum()` the results are correct
> with ``-O``.
> But with ``--O --static-locals`` the results are incorrect again (31757
> and 15408).  ``--static-locals`` alone works though.

The reason was invalid register usage information about the runtime xor
function. The compiler has builtin knowledge about quite some runtime
functions, so it knows if registers inputs and/or destroyed when the function
is called. In case of the xor function, the Y register was wrongly marked as
"retains its value", and the so compiler generated code to reuse this value.

The problem is fixed in the source and the change will be in tonights

Thanks for the report!



Ullrich von Bassewitz                        
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue Nov 2 19:12:13 2010

This archive was generated by hypermail 2.1.8 : 2010-11-02 19:12:16 CET