parser converts gnu statement expressions in for loops to incorrect loop increment that occurs too early in loop code

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Medium
    • Code Generation Tools
    • CODEGEN-14903
    • Show
      https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1592146/msp430fr2355-ti-v21-6-1-strange-for-loop-behavior
    • Hide
      ARM_20.2.7.LTS
      C7000_2.1.2.LTS
      C7000_6.0.0.STS
      C7000_5.0.0.LTS
      C7000_3.0.0.STS
      C7000_3.1.0.LTS
      C7000_4.0.0.STS
      C7000_4.1.0.LTS
      C2000_22.6.0.LTS
      C2000_20.2.7.LTS
      C2000_25.11.0.LTS
      C6000_8.5.0.LTS
      MSP430_21.6.1.LTS
      C6000_8.3.13
      C7000_2.0.0.STS
      C7000_1.4.3.LTS
      C7000_6.1.0.STS
      C2000_21.6.1.LTS
      MSP430_20.2.7.LTS
      Show
      ARM_20.2.7.LTS C7000_2.1.2.LTS C7000_6.0.0.STS C7000_5.0.0.LTS C7000_3.0.0.STS C7000_3.1.0.LTS C7000_4.0.0.STS C7000_4.1.0.LTS C2000_22.6.0.LTS C2000_20.2.7.LTS C2000_25.11.0.LTS C6000_8.5.0.LTS MSP430_21.6.1.LTS C6000_8.3.13 C7000_2.0.0.STS C7000_1.4.3.LTS C7000_6.1.0.STS C2000_21.6.1.LTS MSP430_20.2.7.LTS
    • Hide
      C7000_6.x.0.LTS*
      MSP430_NEXT*
      MSP430_21.6.2.LTS*
      C6000_8.6.0.LTS*
      PRU_2.4.0*
      C2000_NEXT*
      Show
      C7000_6.x.0.LTS* MSP430_NEXT* MSP430_21.6.2.LTS* C6000_8.6.0.LTS* PRU_2.4.0* C2000_NEXT*
    • default
    • Avoid using statement expressions in for loops.

      gnu statement expressions in for loops are incorrectly converted by the parser such that loop increment that occurs too early in loop code.

      Building the test case with v21.6.1 tools moves the location of the loop increment code for the loop on line 3942 to the beginning of the loop, whereas with v21.6.0 and earlier, the increment happens later.  This manifests in incorrect runtime behavior.

      Build the attached test case

      cl430 -@options.txt general_purpose_timer.c

      Look at the corresponding assembly at line 204.  

      When building with v21.6.0, the loop structure is different.

            Assignee:
            TI User
            Reporter:
            TI User
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Connection: Intermediate to External PROD System
                EXTSYNC-6196 - parser converts gnu statement expre...
                SYNCHRONIZED
                • Last Sync Date: