[llvm] [RISCV] Add hasSideEffects = true to ReadFRM (PR #139864)

Gergely Futo via llvm-commits llvm-commits at lists.llvm.org
Wed May 14 03:34:29 PDT 2025


futog wrote:

> Do you have a case to show the miscompile?

With `O3`:

```
#include <assert.h>
#include <float.h>
#include <fenv.h>

#pragma STDC FENV_ACCESS ON

int main() {
    int res;

    res = fesetround(FE_TOWARDZERO);
    if(res == 0) {
        assert(FLT_ROUNDS == 0);
    }

    res = fesetround(FE_TONEAREST);
    if(res == 0) {
        assert(FLT_ROUNDS == 1);
    }

    res = fesetround(FE_UPWARD);
    if(res == 0) {
        assert(FLT_ROUNDS == 2);
    }

    res = fesetround(FE_DOWNWARD);
    if(res == 0) {
        assert(FLT_ROUNDS == 3);
    }
}

```

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


More information about the llvm-commits mailing list