[clang] [ARM] enable FENV_ACCESS pragma support for hard-float targets (PR #137101)

John Brawn via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 24 07:09:28 PDT 2025


john-brawn-arm wrote:

Simple example where setting HasStrictFP=true without doing the above gives wrong results:
```
int fetestexcept( int excepts );
#define FE_DIVBYZERO 0x04

int fn(float x) {
#pragma STDC FENV_ACCESS ON
  x / 0;
  return fetestexcept(FE_DIVBYZERO);
}
```
With --target=aarch64-none-elf we get a divide instruction and so return FE_DIVBYZERO, with --target=arm-non-eabi we get no divide instruction and return 0.

https://github.com/llvm/llvm-project/pull/137101


More information about the cfe-commits mailing list