Tool/software: TI C/C++ Compiler
Hello everyone,
I have observed an issue with the compiler. I reproduced it with every single version of Code Generation Tools currently installed on my computer: 15.12.3.LTS, 16.9.0.LTS, 16.9.2.LTS, 16.12.0.STS, 17.3.0.STS, 17.9.0.STS, 18.1.0.LTS
I have put together a tiny code sample that shows the problem.
void exampleFunction(void) { __edis(); } volatile int exampleVariable; void main(void) { __eallow(); exampleFunction(); __edis(); __eallow(); exampleVariable; __edis(); }
Code Composer Studio compiles this code with the following command:
"C:\\ti\\ccsv5\\utils\\bin\\gmake" -k Sources/bugreport.obj 'Building file: ../Sources/bugreport.c' 'Invoking: C2000 Compiler' "C:/ti/ccsv5/tools/compiler/ti-cgt-c2000_18.1.0.LTS/bin/cl2000" -v28 -mt --symdebug:none --diag_warning=225 -k --obj_directory="Sources" "../Sources/bugreport.c" 'Finished building: ../Sources/bugreport.c' ' ' **** Build Finished ****
The resulting assembly is:
_exampleFunction: EDIS LRETR _main: EALLOW LCR #_exampleFunction MOVW DP,#_exampleVariable MOV AL,@_exampleVariable EDIS LRETR
As you can see the compiler has removed one EDIS and one EALLOW. The EDIS would not have had any effect but the removal of the EALLOW is not OK because my example variable might have been an EALLOW-protected register. Furthermore I have disabled optimization entirely so I'm not very happy about the compiler altering my code despite this setting.
I can't see this bug in the list of open defects but I think it is an big issue.
Regards,
Pierre