Issue 157395
Summary spurious overflow with -frounding-math
Labels new issue
Assignees
Reporter zimmermann6
    ```
$ cat e.c
#include <stdio.h>
#include <stdlib.h>
#include <fenv.h>
 
#pragma STDC FENV_ACCESS ON
 
int
main (int argc, char *argv[])
{
  feclearexcept (FE_OVERFLOW);
  _Float16 x = atof (argv[1]);
  printf ("overflow: %d\n", fetestexcept (FE_OVERFLOW));
  _Float16 r = (x > 0x1.ff4p+12f) ? 0x1p15f16 * 0x1p15f16
 : 0x1.ffcp+15f16 + 1.0f16;
  printf ("overflow: %d\n", fetestexcept (FE_OVERFLOW));
}

$ clang e.c -lm
$ ./a.out 0x1.ff4p+12
overflow: 0
overflow: 8
```
If I replace the conditional (c) ? a : b by if (c) a; else b; there is no overflow. Clang is version 19.1.7.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to