newlib-cygwin/newlib/libc
Corinna Vinschen 27652b608d strtod: Convert 64 bit double to 64 bit int during computation
The gdtoa implementation uses the type long, defined as Long, in lots
of code.  For historical reason newlib defines Long as int32_t instead.

This works fine, as long as floating point exceptions are not enabled.
The conversion to 32 bit int can lead to a FE_INVALID situation.

Example:

  const char *str = "121645100408832000.0";
  char *ptr;

  feenableexcept (FE_INVALID);
  strtod (str, &ptr);

This leads to the following situation in strtod

  double aadj;
  Long L;

  [...]
  L = (Long)aadj;

For instance, on x86_64 the code here is

  cvttsd2si %xmm0,%eax

At this point, aadj is 2529648000.0 in our example.  The conversion to
32 bit %eax results in a negative int value, thus the conversion is
invalid.  With feenableexcept (FE_INVALID), a SIGFPE is raised.

Fix this by always using 64 bit ints here if double is not a 32 bit type
to avoid this type of FP exceptions.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-04-09 11:31:04 +02:00
..
argz ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
ctype newlib: fix iswupper_l in !_MB_CAPABLE case 2018-03-27 12:35:27 +02:00
errno makedoc: make errors visible 2017-12-07 11:54:11 +00:00
iconv ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
include Correct prototypes of pthread_mutex_getprioceiling() and pthread_setschedparam() 2018-03-15 09:25:45 -05:00
locale Locale modifier @cjkwide to adjust ambiguous-width in non-CJK locales 2018-03-05 17:15:12 +01:00
machine epiphany: Additional setjmp() and longjmp() syms 2018-01-31 08:17:19 +01:00
misc ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
posix ansification: remove _HAVE_STDC 2018-01-17 11:47:30 -06:00
reent ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
search Reduce qsort stack consumption 2018-03-16 10:21:23 +01:00
signal ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
ssp makedoc: make errors visible 2017-12-07 11:54:11 +00:00
stdio Add global stdio streams support for reent small. 2018-03-01 18:05:31 -05:00
stdio64 ansification: remove _EXFNPTR, _EXPARM 2018-01-17 11:47:27 -06:00
stdlib strtod: Convert 64 bit double to 64 bit int during computation 2018-04-09 11:31:04 +02:00
string fix/enhance Unicode table generation scripts 2018-03-14 10:44:32 +01:00
sys [arm] Fix syscalls.c for newlib embedded syscalls builds 2018-03-15 09:55:11 +00:00
syscalls ansification: remove _HAVE_STDC 2018-01-17 11:47:30 -06:00
time ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
unix ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
xdr ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
Makefile.am ssp: add build infrastructure 2017-11-29 11:25:46 -06:00
Makefile.in ssp: add build infrastructure 2017-11-29 11:25:46 -06:00
aclocal.m4 Fix up errors in regenerated files for 2.3.0 release. 2016-01-04 12:57:31 -05:00
configure Bump release to 3.0.0 for yearly snapshot 2018-01-18 13:07:45 -05:00
configure.in ssp: add build infrastructure 2017-11-29 11:25:46 -06:00
libc.in.xml ssp: add documentation 2017-11-29 11:25:45 -06:00
libc.texinfo ssp: add documentation 2017-11-29 11:25:45 -06:00
saber
sys.tex Don't include stdio64 functions in reentrant syscalls menu when not bulding stdio64. 2015-08-03 09:54:33 +01:00