[Bug middle-end/29887] wrong-code for errno handling on overflow/underflow

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Feb 24 03:56:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=29887

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2017-02-24
                 CC|                            |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
When compiled with today's GCC 7 the test case prints the expected result.  Is
there still a problem here or can the bug be resolved as fixed?

$ (set -x && cat t.c && for m in 32 64; do gcc -O2 -Wall
-funsafe-math-optimizations -m$m -lm t.c && ./a.out 5000; done)

+ cat t.c
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
  double y = atof(argv[1]);
  double x = exp (y);
  printf("%.6e %.6e\n", y, x);
  perror("errno");
  return 0;
}
+ for m in 32 64
+ gcc -O2 -Wall -funsafe-math-optimizations -m32 -lm t.c
+ ./a.out 5000
5.000000e+03 inf
errno: Numerical result out of range
+ for m in 32 64
+ gcc -O2 -Wall -funsafe-math-optimizations -m64 -lm t.c
+ ./a.out 5000
5.000000e+03 inf
errno: Numerical result out of range


More information about the Gcc-bugs mailing list