This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM2632: SW bug when comparing two float values?

Part Number: AM2632

Tool/software:

Team,

We have a customer that may have found a new bug that they observed in the TI AM263x SDK SW.  They have this if condition where they are comparing two float values as below:

 

This if condition should always be true but they've noticed that sometimes they hit the else part even though they can see that tmp value is 4098360 which is clearly less than the value they are comparing it to.  below are a few screenshots of the assembly code and FPU/CPU registers.

 

 

 

They are using TI ARM CLANG compiler version 3.2.2 LTS. 

 Please let us know your thoughts.

TY,
CY

  • I apologize for the delay.  For the source file that contains the problem if statement, please follow the directions in the article How to Submit a Compiler Test Case.

    Thanks and regards,

    -George

  • Hi George,

    We are working to gather additional information as you noted above from the customer.  I will then submit this offline as you directed.  Any comments in the meantime are certainly welcomed.

    Thank you,

    Chris

  • Hi George,

    Following your guidance - alongside this link - customer has provided the following to you via offline email:

    How to Submit a Compiler Test Case

    Let's still keep this thread open if the customer desires to add comments/etc based on your review.

    TY,
    Chris

  • The customer supplied part of what is required to submit a test case.  But not all of it.  I'm waiting on the rest.

    Thanks and regards,

    -George

  • George,

    For completeness of this E2E thread, this information was provided in email format offline on 4/6.

    • What are your Compiler optimization settings?

    O1

    • Do you have ample stack and RAM memory allocation?

    I think so, we tried to double and quadruple the stack size and that didn't solve the issue.

    • Stack and Heap (if used) OK?

    As far as we can tell Stack and Heap are ok. We tried to typecast the float variable and that seems to have solved the issue, I would like to bring your attention to register FPSCR, in our screenshot that register value is zero. It should have a value after a float comparison.

    • Running also under the TI MCAL Layer or not in this case?

    Yes we are using TI MCAL Layer.

    1. Preprocessed source file

    Let me check if we can share the source file and get back to you.

    1. Compiler Version

    TI-ARM Clang Compiler 3.2.2 LTS

    1. Compiler Options Used

    This email offline also included the compiler options file (cc_options.opt)

    [TI] We know that the build options are important to reproducing the problem.  But we also need the source code.  We don’t see how to advance the issue without it.  

    We have requested again from customer.

    TY,

    Chris

  • OK Team,

    Shockingly, regarding the float compare issue.  Customer has discovered that we needed to enable "Task Uses FPU" option in the Os Tasks configuration that seems to have solved the issue.

     While investigating this issue they also updated the TI ARM CLANG compiler version from 3.2.2 LTS to 4.0.2, while that didn't solve this issue, they used to see some fluctuations in ADC readings which became more stable after updating the compiler. They'll add their findings to the forum post, and we can close this issue. Thank you. 

    That said, any confirmation that this indeed SOLVES the original issue is welcomed.

    TY,
    Chris