Re: [cc65] Optimizing code fails - Found the error!

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-11-22 12:54:32


Hi!

On Sat, Nov 22, 2003 at 12:38:26PM +0100, Benjamin Bahnsen wrote:
> i finally found the problem. It seems to be a bug in the compiler.

Yes, it is one. But it's difficult so solve.

The optimizer knows which registers must be valid when returning from a
function by looking at the return type. A function returning void doesn't need
to return a value in a/x, so the optimizer will remove any code loading
something into these registers. This is what happened with your interrupt
procedure: The tax and tay instructions got removed, because the compiler
looked at the return type and decided they were unnecessary.

I have currently no idea how to change that without removing functionality.
Not the best idea, but at least a workaround to prevent people from falling
into this problem would be to remove the RTI instruction from the inline
assembler, so one will have to use the external assembler for interrupt
handlers. Better ideas anyone?

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-11-22 12:54:45 CET