[EXT_EP-9787] Enum type with no enumerators fails to emit DW_AT_byte_size, crashes CCS Created: 04/May/20  Updated: 04/May/20  Resolved: 04/May/20

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: CCS Debugger
Internal ID: CCBT-2559
Forum URL: https://e2e.ti.com/support/tools/ccs/f/81/t/858223
Found In Release: ARM_18.1.0.LTS
MSP430_18.1.0.LTS
C6000_8.2.0
C6000_8.3.0
MSP430_20.2.0.LTS
ARM_18.12.0.LTS
MSP430_18.12.0.LTS
ARM_20.2.0.LTS
Fix In Release: ARM_18.12.5.LTS
MSP430_20.2.0.LTS
ARM_18.1.8.LTS
MSP430_18.1.8.LTS
C6000_8.3.6
ARM_20.2.0.LTS
C6000_8.2.9
MSP430_18.12.5.LTS
Affected Platform/Device: default
Workaround: Add a dummy enumerator to the enum type, like so:
enum e { fake = 0 };
Release Notes: The test case has an enumeration type with no enumerators. This is not legal in C, but in C++, it is legal to have no enumerators, in which case [C++98 7.2 "Enumeration declarations" p5] "If the enumerator list is empty, the underlying type is as if the enumeration had a single enumerator with value 0." In other words, the enum is a complete type with non-zero size. However, the compiler mistakenly thinks that this enum is incomplete, so it does not emit a DW_AT_byte_size attribute in the DWARF information for the enumeration type. This lack causes CCS to crash when attempting to display a variable declared with that enumeration type.

 Description   

Customer observed that CCS9.2 crashed on the test case. CCS5.5 did not crash.

It turns out that the C++ test case contains an enumerated type with no enumerators.

The compiler thought this type was incomplete and failed to emit a DW_AT_byte_size attribute in the DWARF information.

CCS didn't check that this attribute actually exists and crashed.


Generated at Tue Apr 15 14:41:41 CDT 2025 using Jira 9.12.17#9120017-sha1:aba4002bcd633f188b6a4bb5dd8a0e1f20b79ee4.