You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.4 KiB

  1. From 0562b040fa17f1722ba2b3096067b45d0582ca53 Mon Sep 17 00:00:00 2001
  2. From: Paul Eggert <address@hidden>
  3. Date: Mon, 11 Mar 2019 16:40:29 -0700
  4. Subject: [PATCH] strtod: fix clash with strtold
  5. Problem reported for RHEL 5 by Jesse Caldwell (Bug#34817).
  6. * lib/strtod.c (compute_minus_zero, minus_zero):
  7. Simplify by remving the macro / external variable,
  8. and having just a function. User changed. This avoids
  9. the need for an external variable that might clash.
  10. --- a/lib/strtod.c
  11. +++ b/lib/strtod.c
  12. @@ -294,16 +294,15 @@ parse_number (const char *nptr,
  13. ICC 10.0 has a bug when optimizing the expression -zero.
  14. The expression -MIN * MIN does not work when cross-compiling
  15. to PowerPC on Mac OS X 10.5. */
  16. -#if defined __hpux || defined __sgi || defined __ICC
  17. static DOUBLE
  18. -compute_minus_zero (void)
  19. +minus_zero (void)
  20. {
  21. +#if defined __hpux || defined __sgi || defined __ICC
  22. return -MIN * MIN;
  23. -}
  24. -# define minus_zero compute_minus_zero ()
  25. #else
  26. -DOUBLE minus_zero = -0.0;
  27. + return -0.0;
  28. #endif
  29. +}
  30. /* Convert NPTR to a DOUBLE. If ENDPTR is not NULL, a pointer to the
  31. character after the last one used in the number is put in *ENDPTR. */
  32. @@ -479,6 +478,6 @@ STRTOD (const char *nptr, char **endptr)
  33. /* Special case -0.0, since at least ICC miscompiles negation. We
  34. can't use copysign(), as that drags in -lm on some platforms. */
  35. if (!num && negative)
  36. - return minus_zero;
  37. + return minus_zero ();
  38. return negative ? -num : num;
  39. }