Re: [cc65] Overflows in signed comparisions

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-10-10 21:32:41


On Fri, Oct 10, 2003 at 08:20:29PM +0200, Groepaz wrote:
> wow....nice one :) all of the tests work again (ie, no more crashes) and
> additionally 5 of 9 previously failing tests even return the correct
> result(s) :=) lemme see if i can isolate the remaining problem(s) .... :)

Maybe it's easier if you send me the test code?

> oh one somewhat unrelated bug (slight chance its related to signed comparison
> though ;=P) ... (if that even is one - i think i remember this
> beeing a know limitation...mmmh - whatever :))
[...]

No, I've generated undefined behaviour in the type conversion code. Shame on
me, I should know - and it was discussed a few months ago in de.comp.lang.c:
Shifting a variable by the number of bits it has does not create zero but is
undefined. So

        Expr->ConstVal |= ((~0L) << NewBits);

is invalid if NewBits is the number of bits in a long. This is what caused the
problem. 

Thanks a lot!


        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-10-10 21:33:00 CEST