Pointer math addend incorrectly truncated to ptrdiff_t on MSP430

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Medium
    • Code Generation Tools
    • CODEGEN-1995
    • Hide
      MSP430_15.12.0.LTS
       MSP430_16.9.0.LTS
      Show
      MSP430_15.12.0.LTS  MSP430_16.9.0.LTS
    • Hide
      MSP430_17.9.0.STS
       MSP430_16.9.6.LTS
      Show
      MSP430_17.9.0.STS  MSP430_16.9.6.LTS
    • Hide
      The compiler was incorrectly handling array index expressions where the value of the index expression did not fit in ptrdiff_t. In some cases, the compiler would truncate the value to ptrdiff_t, changing the value. This bug can only occur in restricted or large data models.

      This fix can affect the compiler's ability to optimize code. Importantly, for restricted data model, the compiler can no longer assume that pointer index expressions can use indexed addressing mode. Indexed addressing mode has a 16-bit signed offset, which may not be big enough to hold the value of the index expression. In this case, the pointer index expression must be carried out as pointer arithmetic followed by a non-indexed addressing mode, which requires more instructions and thus more cycles. This means that in restricted data model, there may be a performance loss when upgrading to this version.

      Whether this loss occurs, and how big the loss is, depends greatly on whether your program uses pointer index expressions in critical loop bodies. We have observed that most of our benchmarks are unaffected, but we have some benchmarks that degraded after this fix.
      Show
      The compiler was incorrectly handling array index expressions where the value of the index expression did not fit in ptrdiff_t. In some cases, the compiler would truncate the value to ptrdiff_t, changing the value. This bug can only occur in restricted or large data models. This fix can affect the compiler's ability to optimize code. Importantly, for restricted data model, the compiler can no longer assume that pointer index expressions can use indexed addressing mode. Indexed addressing mode has a 16-bit signed offset, which may not be big enough to hold the value of the index expression. In this case, the pointer index expression must be carried out as pointer arithmetic followed by a non-indexed addressing mode, which requires more instructions and thus more cycles. This means that in restricted data model, there may be a performance loss when upgrading to this version. Whether this loss occurs, and how big the loss is, depends greatly on whether your program uses pointer index expressions in critical loop bodies. We have observed that most of our benchmarks are unaffected, but we have some benchmarks that degraded after this fix.

      Pointer math addend incorrectly truncated to ptrdiff_t on MSP430

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

              Created:
              Updated:
              Resolved:

                Connection: Intermediate to External PROD System
                EXTSYNC-741 - Pointer math addend incorrectly tru...
                SYNCHRONIZED
                • Last Sync Date: