[cc65] Strange calculation error...

From: Christian Krüger <C.Krueger.B1web.de>
Date: 2012-12-28 21:54:52
Hi,

the following code makes trouble:


{
	unsigned char buffer[2];
	unsigned char v = 2;
		
	int v8 = v%8;
	int vx = 7 - v8;
		
	*(buffer+v/8) = 1 << (7 - v8);     // wrong result here!
	*(buffer+v/8+1) = 1 << vx;
	
	if (buffer[0] != buffer[1])
		assert(0);	
}

(If I remove the buffer offset calculation from the commented line, the 
result is ok (like the result one line below)).

Tried with the latest snapshot (-r -Os) - compiler malfunction?

Regards
Christian


----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Dec 28 21:55:07 2012

This archive was generated by hypermail 2.1.8 : 2012-12-28 21:55:11 CET