[EXT_EP-11471] Compiler fails with internal error "Bad kind: TYPE::type_pointed_to" Created: 06/Oct/23  Updated: 02/Apr/24  Resolved: 16/Oct/23

Status: Fixed
Project: Embedded Software & Tools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Medium
Reporter: TI User Assignee: TI User
Resolution: Fixed Votes: 0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Product: Code Generation Tools
Internal ID: CODEGEN-11634
Found In Release: C6000_8.3.0
MSP430_20.2.0.LTS
C7000_2.1.0.LTS
C2000_22.6.1.LTS
MSP430_21.6.0.LTS
C2000_21.6.0.LTS
PRU_2.3.0
C7000_3.1.0.LTS
ARM_20.2.0.LTS
Fix In Release: MSP430_20.2.8.LTS*
C7000_2.1.3.LTS*
MSP430_21.6.2.LTS*
C7000_3.1.1.LTS
C2000_22.6.2.LTS*
C6000_8.3.13
ARM_20.2.8.LTS*
PRU_2.3.4*
C2000_21.6.2.LTS*
Affected Platform/Device: default
Workaround: use --opt_level=0 or 1 instead of 2

See below for instructions on how to set compiler options per file instead of entire project in CCS projects:
https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_project-management.html#file-specific-options

 Description   

With --opt_level=2, the optimizer generates "internal error" for arrays of pointers similar to below example:
TP>> internal error: Bad kind: TYPE::type_pointed_to

void foo(void)

{ char* argv[1]; parse_args(argv); }

NOTE: earlier fix in CODEGEN-11223 missed a use case that this fix addresses.

More details:
----------------
The attached file has these lines ...

static inline __erase_vector __parse_args(uint8_t* ptrInput, uint8_t* argv[])
{
    /* code here */
}

Build it ...

% cl2000 -@options.txt file.c
"file.c", line 2639: warning #303-D: typedef name has already been declared (with same type)
"file.c", line 2640: warning #303-D: typedef name has already been declared (with same type)
"file.c", line 2679: warning #303-D: typedef name has already been declared (with same type)
TP>> internal error: Bad kind:  TYPE::type_pointed_to
This is caused by a defect in the TI C/C++ Optimizer.
TI Customer Support may be able to suggest a workaround to avoid this.

Upgrading to the newest version of the compiler may fix this problem.

Contact TI in the E2E support forums at http://e2e.ti.com under
"Development Tools", "TI C/C++ Compiler".  See the link titled
"Submitting an issue".

We need to see this ENTIRE error message and a complete, reproducible
test case including ALL of the command-line options.
Include the .pp file created by option --preproc_with_comment


>> Compilation failure

Replace that function with an extern declaration ...

extern __erase_vector __parse_args(uint8_t* ptrInput, uint8_t* argv[]);

... and it builds clean.


Generated at Mon Apr 14 01:33:37 CDT 2025 using Jira 9.12.17#9120017-sha1:aba4002bcd633f188b6a4bb5dd8a0e1f20b79ee4.