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

Incorrect value from conditional statement computing a bool

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • Code Generation Tools
    • CODEGEN-12801
    • Hide
      C2000_22.6.0.LTS
      C6000_8.3.0
      MSP430_20.2.0.LTS
      MSP430_21.6.0.LTS
      C2000_21.6.0.LTS
      PRU_2.3.0
      C7000_3.1.0.LTS
      C7000_4.1.0.LTS
      C2000_20.2.0.LTS
      Show
      C2000_22.6.0.LTS C6000_8.3.0 MSP430_20.2.0.LTS MSP430_21.6.0.LTS C2000_21.6.0.LTS PRU_2.3.0 C7000_3.1.0.LTS C7000_4.1.0.LTS C2000_20.2.0.LTS
    • Hide
      MSP430_20.2.8.LTS*
      MSP430_21.6.2.LTS*
      C2000_22.6.1.LTS
      C2000_22.6.2.LTS*
      C7000_4.1.2.LTS*
      C7000_5.0.0.LTS
      C6000_8.3.14*
      C7000_3.1.3.LTS*
      PRU_2.3.4*
      Show
      MSP430_20.2.8.LTS* MSP430_21.6.2.LTS* C2000_22.6.1.LTS C2000_22.6.2.LTS* C7000_4.1.2.LTS* C7000_5.0.0.LTS C6000_8.3.14* C7000_3.1.3.LTS* PRU_2.3.4*
    • default

      At optimization level -O2 or higher, the optimizer may incorrectly truncate values larger than the size of "bool" when using a ternary (? operator is used to compute a boolean value. The exact conditions for this to occur are not clear, because the compiler can transform conditional statements (like if statements) into the ternary operator, which can trigger the bug. This bug has only been observed for C6x in C++ mode, when the original test case does not directly use the ternary operator, and the boolean value being computed is stored in a struct member with type "bool," but it may occur under other conditions.

      if (!data[0] && !data[1]) s.b = true else s.b = false;

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

              Created:
              Updated:
              Resolved: