TI E2E Community
TI C/C++ Compiler
TI C/C++ Compiler - Forum
warning: symbol .. redeclared with incompatible type
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 22.214.171.124
- 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?
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.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.