FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
PCD V4.115 continues to believe: 1000 + 0 = 0 |
Posted: Tue Dec 14, 2010 3:47 am |
|
|
A PCD bug, that can be reproduced with the below code has been reported on Nov 01. Unfortunately it's still
present in newly released V4.115. So I have to keep V4.112 for the time being.
Code: | #include <24FJ128GA106.h>
#use delay(clock=8000000)
#use RS232(baud=1200, UART1)
void main()
{
signed x,y,z;
x=1000;
y=0;
z = x + (((signed int32)x*y) >> 16);
printf("%i %i %i\r\n",x,y,z);
while(1);
} |
It's another case of the well-known register confusion with PCD. This time an intermediate result is overwritten during the arithmetic evaluation. |
|