the following code works with V219Ga but does not with the current release.
xdata unsigned char KeyBuffer[8];
unsigned int Translate()
{
unsigned int temps;
LastKeyPressed = getchar();
KeyBuffer[ 0 ] = LastKeyPressed;
putchar( LastKeyPressed );
LastKeyPressed = getchar();
KeyBuffer[ 1 ] = LastKeyPressed;
putchar( LastKeyPressed );
LastKeyPressed = getchar();
KeyBuffer[ 2 ] = LastKeyPressed;
putchar( LastKeyPressed );
LastKeyPressed = getchar();
KeyBuffer[ 3 ] = LastKeyPressed;
putchar( LastKeyPressed );
LastKeyPressed = getchar();
KeyBuffer[ 4 ] = LastKeyPressed;
putchar( LastKeyPressed );
KeyBuffer[ 5 ] = 0x00;
putchar(' ');
putchar(KeyBuffer[0]);
putchar(KeyBuffer[1]);
putchar(KeyBuffer[2]);
putchar(KeyBuffer[3]);
putchar(KeyBuffer[4]);
temps= atoi( &KeyBuffer[0] ); // <- atoi()
printf(" %d",temps);
return (temps);
// return atoi( &KeyBuffer[0] );
}
with V219Ga the output is
24555 24555 24555
with V220a i get
24555 24555 2555
so KeyBuffer[] holds to correct value, but atoi () does not convert correct.
Michael
Without a modification of the code above, but with some modification of the rest of the sources (outside the function), this function works in V220a.
so atoi() seems to work, but it is unclear to me why it did not work when i posted this message.
assume this bug to be closed.
It seem, that SDCC has problem with pointers, pointing
into XDATA region.
I \"solved\" a similar problem with the volatile qualifier.
Logged In: YES
user_id=63512
Can you confirm this still exists in 2.2.2pre?