Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-9787

Enum type with no enumerators fails to emit DW_AT_byte_size, crashes CCS

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • CCS Debugger
    • CCBT-2559
    • Hide
      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
      Show
      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
    • Hide
      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
      Show
      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
    • default
    • Hide
      Add a dummy enumerator to the enum type, like so:
      enum e { fake = 0 };
      Show
      Add a dummy enumerator to the enum type, like so: enum e { fake = 0 };
    • Hide
      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.
      Show
      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.

      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.

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: