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

Compiler may lose volatile qualifier in A->B->C when B and C are both volatile

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Fixed
    • Priority: Medium
    • Resolution: Fixed
    • Product:
      Code Generation Tools
    • Internal ID:
      CODEGEN-5943
    • Found In Release:
      Hide
      C6000_8.2.0
      C2000_18.1.0.LTS
      C6000_8.3.0
      ARM_18.12.0.LTS
      PRU_2.3.0
      ARM_18.1.0.LTS
      MSP430_18.1.0.LTS
      C2000_19.6.0.STS
      ARM_16.9.0.LTS
      ARM_19.6.0.STS
      MSP430_18.12.0.LTS
      MSP430_19.6.0.STS
      C2000_18.12.0.LTS
      Show
      C6000_8.2.0 C2000_18.1.0.LTS C6000_8.3.0 ARM_18.12.0.LTS PRU_2.3.0 ARM_18.1.0.LTS MSP430_18.1.0.LTS C2000_19.6.0.STS ARM_16.9.0.LTS ARM_19.6.0.STS MSP430_18.12.0.LTS MSP430_19.6.0.STS C2000_18.12.0.LTS
    • Fix In Release:
      Hide
      MSP430_18.12.2.LTS
      ARM_18.1.6.LTS
      MSP430_18.1.6.LTS
      PRU_2.3.2
      C2000_19.6.0.STS
      C2000_18.1.6.LTS
      C2000_18.12.2.LTS
      PRU_2.4.0*
      ARM_19.6.0.STS
      ARM_18.12.2.LTS
      C6000_8.3.4
      C6000_8.2.7
      MSP430_19.6.0.STS
      Show
      MSP430_18.12.2.LTS ARM_18.1.6.LTS MSP430_18.1.6.LTS PRU_2.3.2 C2000_19.6.0.STS C2000_18.1.6.LTS C2000_18.12.2.LTS PRU_2.4.0* ARM_19.6.0.STS ARM_18.12.2.LTS C6000_8.3.4 C6000_8.2.7 MSP430_19.6.0.STS
    • Workaround:
      Hide
      The expression has to contain both dereferences, eg, a->b->c, for the problem to appear. If they're separated by using a temp, as in

        T * volatile p;
        p = a->b;
        ... p->c ...

      then the problem should be avoided. Making the temp "p" volatile is also important, to prevent the compiler from recombining the two dereferences.

      Or compile with -o1, -o0, or -ooff.
      Show
      The expression has to contain both dereferences, eg, a->b->c, for the problem to appear. If they're separated by using a temp, as in   T * volatile p;   p = a->b;   ... p->c ... then the problem should be avoided. Making the temp "p" volatile is also important, to prevent the compiler from recombining the two dereferences. Or compile with -o1, -o0, or -ooff.
    • Release Notes:
      Hide
      In an expression like A->B->C, when B and C are both volatile structure fields, we'd expect to see two distinct memory accesses every time. There is a bug in the compiler specifically with having two dereferences in a single expression, ie, A->B->C, in which it may lose the volatile qualifier from B. That may lead it to save A->B in a temporary variable and reuse that value instead of re-reading it as is supposed to happen.
      Show
      In an expression like A->B->C, when B and C are both volatile structure fields, we'd expect to see two distinct memory accesses every time. There is a bug in the compiler specifically with having two dereferences in a single expression, ie, A->B->C, in which it may lose the volatile qualifier from B. That may lead it to save A->B in a temporary variable and reuse that value instead of re-reading it as is supposed to happen.

      Description

      Compiler may lose volatile qualifier in A->B->C when B and C are both volatile

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: