[cc65] Bug in signed comparisions!

Date view Thread view Subject view

From: Piotr Fusik (P.Fusik_at_elka.pw.edu.pl)
Date: 2002-04-17 09:35:24


Signed comparisions give incorrect results, if the difference between
compared numbers is >=0x8000 (for ints) or >=0x80000000 (for longs).
In the attached test program, compiled with cc65 2.8.0, the condition
-0x7fff < 0x7fff is FALSE. That's because, for signed integers,
"less than" condition should be computed as N_flag^V_flag rather than
by simply testing the N flag.

I include fixed icmp and lcmp runtime functions. Fixes are also needed
for optimized inline compares.

BTW.
cc65 -O test.c
prints:
The instruction at 0x0040d980 referenced memory at 0xffffffff.
The memory could not be read.

Bye,
Piotr





---------------------------------------------------------------------- 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 : 2002-04-17 09:35:51 CEST