Issue 52891
Summary Calls to functions which may change the state of the floating-point environment may be optimized out
Labels new issue
Assignees
Reporter PavelMorozkin
    Sample code:
```
#include <fenv.h>
#include <math.h>

#if __STDC__ == 1 && __STDC_IEC_559__ == 1

#pragma STDC FENV_ACCESS ON

int main(void)
{
    sin(0.5);
    return fetestexcept(FE_INEXACT) ? 0 : 1;
}

#endif
```
Options: `-O1 -std=c11 -pedantic -Wall -Wextra -lm -ffp-model=strict`
Generated code:
```
main: # @main
        push rax
        mov edi, 32
        call fetestexcept
```
Here we see that `call sin` was incorrectly optimized out.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to