[EXT_EP-8981] Conditional expression containing GNU statement expression crashes compiler in C++ mode Created: 25/Jun/18  Updated: 12/Aug/24  Resolved: 18/Apr/22

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-4942
Forum URL: https://e2e.ti.com/support/development_tools/compiler/f/343/t/702523
Found In Release: C6000_8.3.0
MSP430_20.2.0.LTS
C7000_2.1.0.LTS
C6000_8.1.3
C6000_8.2.3
ARM_18.12.0.LTS
C2000_21.6.0.LTS
PRU_2.3.0
ARM_20.2.0.LTS
C2000_20.2.0.LTS
C7000_1.4.0.LTS
MSP430_18.12.0.LTS
C2000_18.12.0.LTS
Fix In Release: ARM_20.2.7.LTS
C7000_2.1.2.LTS
C2000_18.12.9.LTS
C2000_20.2.7.LTS
MSP430_21.6.1.LTS
C6000_8.3.13
C7000_1.4.3.LTS
MSP430_18.12.9.LTS
PRU_2.3.4*
ARM_18.12.9.LTS*
C2000_21.6.1.LTS
MSP430_20.2.7.LTS
Workaround: Rewrite the code to avoid the use of GNU statement expressions. For this test case, move the function call out of the conditional clause and save its result to a temporary, then use that temporary in the conditional.
For example:
bool temp = func(arg1, ..., ({gcc statement}));
if (temp) { ... }
Release Notes: This bug occurs when a conditional clause includes a function call, and that function call has a GCC statement as an argument.
For example:
if (func(arg1, ..., ({gcc statement}))) { ... }

 Description   

The TI compiler accepts the GNU extension statement expressions in both C and C+. This feature allows using a statement where an expression is allowed in standard C or C, but a statement is not. If one of these statement expressions is used inside a conditional expression (such as that of an if, while, or for), the compiler will fail with an internal error when the code is compiled in C+ mode.


Generated at Wed Apr 02 04:56:24 CDT 2025 using Jira 9.12.17#9120017-sha1:aba4002bcd633f188b6a4bb5dd8a0e1f20b79ee4.