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

Expression with large numbers optimized incorrectly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • Code Generation Tools
    • CODEGEN-8437
    • Hide
      C6000_8.3.6
      C6000_8.3.8
      Show
      C6000_8.3.6 C6000_8.3.8
    • Hide
      MSP430_20.2.8.LTS*
      MSP430_21.6.2.LTS*
      C2000_22.6.2.LTS*
      C6000_8.3.13
      C7000_4.1.1.LTS*
      PRU_2.3.4*
      C7000_3.1.2.LTS*
      Show
      MSP430_20.2.8.LTS* MSP430_21.6.2.LTS* C2000_22.6.2.LTS* C6000_8.3.13 C7000_4.1.1.LTS* PRU_2.3.4* C7000_3.1.2.LTS*
    • default

      The attached source file is a complete single file program.  It has this line ...

      fxdLogX = -6 * (X - 5000) * (X - 5000) + 120040 * (X - 5000) - 1682360000;

      It appears two times in slightly different contexts.  The code generated for each appearance of this expression is quite different.  The results computed are unexpectedly different.  

      Build the program ...

      % cl6x -mv6500 -g -s -o1 main.c -z -o main.out -m main.map 
      <Linking>
      

      When it is executed ...

      Fail!
      x = 2000
      func_fail(x) = 439698000
      func_pass(x) = -419296000
      Assertion failed, (0), file main.c, line 66
      

      The value 2000 is used because it does not cause the expression to overflow.  The func_fail and func_pass lines should show the same value.  The Assertion line should not appear.

            syncuser TI User
            syncuser TI User
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: