Hello community!,
I encounter warnings of the following kind when building my project:
warning: symbol 'gpDspPointer' redeclared with incompatible type in 'Y:/XX/../Dsp_Globals.h' line 52 and 'Y:/XX/../Dsp_Globals.h' line 52
Note that the both mentioned code lines are absolutely the same, and it's the same file.
Some more background info:
- CCS 3.3.38.2
- Code Generation Tools v6.1.15
- Embedded C++
- C64x+ (-mv6400+)
- It only happens with the "-pm -op3" option switched on
Is this a bug in the CGT? Can I savely ignore those warnings?
BR,
Bertram
A single declaration can be compiled differently when included in different modules if it depends on types or macros defined in another file. Perhaps a #define is being set differently on one path? It would help to generate the preprocessed versions of the two files in question and compare all of the definitions leading up to defining the symbol gpDspPointer.
This warning might be harmless, if the two instances end up being bitwise identical, but it could also be a more severe problem; it's impossible to say without seeing a test case.
Why do these warning messages show up only with program level optimization (-pm -op3) ?
Because the linker cannot check for type mismatch. Program level optimization gives the whole program to the compiler at once, and the compiler is what does type checking. If the types truly do not match, and you do not use -pm, neither the compiler nor the linker will detect the problem. The program will compile and link, but you'll have a lurking bug. The recommended method to avoid this problem is to make sure every function and variable has a correct declaration in a header file shared by all modules.