[EXT_EP-11845] For a float if statement followed by divide, compiler generated code performs divide first Created: 30/Jul/24  Updated: 13/Aug/24  Resolved: 13/Aug/24

Status: Declined
Project: Embedded Software & Tools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Not Prioritized
Reporter: TI User Assignee: TI User
Resolution: Duplicate Votes: 0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Product: Code Generation Tools
Internal ID: CODEGEN-12700
Forum URL: https://e2e.ti.com/e2eprivate/continental/continental-adcu5/f/1194/t/1392796
Found In Release: ARMCLANG_4.0.0.LTS
ARMCLANG_3.2.2.LTS
Affected Platform/Device: default
Decline Reason: This functionality is implemented as a new feature in the 4.0.0.LTS release of the tools via "-ffp-exception-behavior=strict|maytrap" option which can be used to prevent floating point exceptions by preventing floating point operations from being moved outside of conditional control flow.

Please see the release notes for more information on how to use this option:
https://software-dl.ti.com/codegen/esd/cgt_public_sw/ARM_LLVM/4.0.0.LTS/README.html#suppress-floating-point-speculation-with--ffp-exceptions-compiler-option

 Description   

The related test case has these lines ...

  if(float1 > CP_MIN)
  {
    f_array[1u] = (1.f / *f_Info);
  }

Code generated by the compiler performs the division before the if statement. For values where that divide causes an FPU exception to be raised, the if statement should keep the divide from happening. But because the divide happens no matter what, the FPU exception is incorrectly raised for those values.


Generated at Wed Apr 02 01:20:18 CDT 2025 using Jira 9.12.17#9120017-sha1:aba4002bcd633f188b6a4bb5dd8a0e1f20b79ee4.