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
TI v6.2.8 compiler, when the [3 interprocedure optimization] is selected, the first OR operation (tmp_1st |= 0xFFFFFF00) of the following code will be optimized as follows,
The high eight bits of the variable tmp_1st are not assigned, which results in an error in the result of the operation. The second OR operation has no problem.
I tried to use a higher version of the compiler (TI v18.1.4.LTS) and confirmed the phenomenon.
The above problems will not occur when the same code is executed and the [3 interprocedure optimization] are executed.
Is it a problem with the compiler TI v6.2.8?
.c file
.asm file
TI v6.2.8
Optimization level:3 Interprocedure Optimizations
#include <stdio.h> unsigned pData[2] = {1,2}; typedef union{ unsigned Word[2]; unsigned long Dword; }wordDWord; long value_1st,value_2nd = 0; int main(void) { long tmp_1st,tmp_2nd; if(0x0080 & tmp_1st){ tmp_1st |= 0xFFFFFF00; } if(0x0080 & tmp_2nd){ tmp_2nd = tmp_2nd | 0xFFFFFF00; } value_1st = tmp_1st; value_2nd = tmp_2nd; return 0; }
For the source file which has this problem, please follow the directions in the article How to Submit a Compiler Test Case.
Version 6.2.8 is about 6 years old, and it is no longer supported. But I might be able to find a workaround. And I would like to make sure the problem is not present in current versions of the compiler.
Thanks and regards,
-George