This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: TI C/C++ Compiler
I have a piece of code which compiles fine in CCS6 (compiler 6.4.12), but does not compile in CCS8 (compiler 18.1.5.LTS).
This throws an error:
__byte((int*)rtc_output_array,0xA+1) = 0;
__byte((int*)rtc_output_array,0xB+1) = 0;
__byte((int*)rtc_output_array,0xC+1) = 0;
__byte((int*)rtc_output_array,0xD+1) = 0;
__byte((int*)rtc_output_array,0xE+1) = 0; //line 612: error #19: extra text after expected end of number
But this compiles fine in CCS8:
__byte((int*)rtc_output_array,0xA+1) = 0;
__byte((int*)rtc_output_array,0xB+1) = 0;
__byte((int*)rtc_output_array,0xC+1) = 0;
__byte((int*)rtc_output_array,0xD+1) = 0;
__byte((int*)rtc_output_array,0xD+2) = 0;
Something about 0xE + a number does not seem to work in CCS8 using 18.1.5.LTS.
Thank you for reporting this problem, and for including a concise test case. I can reproduce the same behavior. I filed the entry CODEGEN-6029 in the SDOWP system to have this investigated. You are welcome to follow it with the SDOWP link below in my signature.
Thanks and regards,
-George
This is not a bug. Unfortunately, the parsing rules for C code are a bit complicated, and this is an example of a bizarre corner that one usually does not notice. The C standard tells us that programs are parsed token-by-token, and each token may be one of several things including a keyword, an identifier, or a "preprocessing number", which includes integer constants. (See C99 6.4.8 "Preprocessing numbers," but essentially the same text appears in C89.) "A preprocessing number starts with a digit optionally preceded by a period and may be followed by [..] the character sequences e+, e-, E+, E- [..]." This means that the compiler is required to consider the character sequence "0xE+" as a valid preprocessing number. Unfortunately, this is not a legal constant of any form, thus you see the error. To work around this issue, put a space between the E and the plus sign.