Dear developers,
I tested the following example with v2.9 release and with snapshot #5703. In both the cases, it is resulting in a compilation error, which I feel is wrong. Please correct me if I am wrong.
#include<stdio.h>
x(const char*s)
{
char a[1];
const char*ss=s;
a[*(s++)]|=1; -----------------------> The value of the constant variable 's' is not modified rather the pointer is incremented for which SDCC is throwing error.
return(int)ss+1==(int)s;
}
main(){
if(x("")!=1)
{
printf("Test Failed");
return -1;
}
else
printf("Test Completed\n");
return 0;
}
sdcc -mmcs51 --model-small Test.c -o Test.hex
error 33: Attempt to assign value to a constant variable (=)
SDCC 2.9.7 #5703:
SDCC : mcs51/gbz80/z80/ds390/pic16/pic14/TININative/ds400/hc08 2.9.7 #5703 (Feb 21 2010) (MINGW32)
SDCC 2.9:
SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.9.0 #5416 (Mar 22 2009) (MINGW32)
Thanks,
Raghu.
Fixed in SDCC 2.9.7 #5821.