Compiler emits the wrong constant when the input to __delay_cycles exceeds INT32_MAX

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Low

      The problem only occurs when building on Linux.

      The attached file.c contains these lines ...

      const uint32_t MAX_CYCLES_WITHOUT_ERROR = INT32_MAX;
      void main(void)
      {
        __delay_cycles(MAX_CYCLES_WITHOUT_ERROR);
        __delay_cycles(MAX_CYCLES_WITHOUT_ERROR+22);
      }
      

      Build it ...

      $ clpru -s file.c
      "file.asm", WARNING! at line 76: [W0001] Constant value out of range, will be
                                               truncated to 32 bits
                      LDI32    r0, 9223372035781033993
      
      No Assembly Errors, 1 Assembly Warning
      

      This line is associated with the second call to __delay_cycles. When built on Windows, the compiler emits this instead ...

              LDI32    r0, 1073741833
      

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

              Created:
              Updated:

                Connection: Intermediate to External PROD System
                EXTSYNC-3991 - Compiler emits the wrong constant w...
                SYNCHRONIZED
                • Last Sync Date: