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.

MSP430 optimization level 4 causes an error

My MSP430 customer reported TI compiler (v4.4.1) generates below error if “4 whole optimization” level is used.

> error: symbol "SelfTestErrorCode" redeclared with incompatible type:

Up to “3 interprocedure optimization” is OK.
What is root cause of the error ?

Thanks and regards,
Koichiro

  • Usually that error message is accurate; the symbol is used in one file and declared in another with different declarations, and when you use level 4 optimization, the compiler gets picky about that stuff. The difference is sometimes very hard to spot. Could you get a test case from the user? If not, the user will need to carefully examine each instance of SelfTestErrorCode to make sure they are declared in exactly the same way. In addition, if its type is a derived type, the user will need to make sure each type it is derived from is exactly the same, including struct members, and each type those types are derived from, and so on.
  • Hi,Thank you for your reply. I will ask customer to give us the project.
    By the way, could you tell me why the issue is reported only with level4 ?
    It is not checked with level3 and lower level ?Thanks and regards,Koichiro
  • Optimization level 4 is cross-file optimization. Type checking in the linker is only performed when using cross-file optimization. Level 3 does not perform cross-file optimization.
  • Sorry for late reply.This item is now closed.Thanks a lot for your help on this!
    Thanks and regards,Koichiro