Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2021-11-29 15:56:46 +0300
committerTakashi Yano <takashi.yano@nifty.ne.jp>2021-11-29 16:51:16 +0300
commit48f6c59332ee2970cd4b172278176dcfe32a328d (patch)
tree958c95110c5543b1e8f04b9b662fc21b4dcf706d /newlib/libc
parent3502a6ff2e2740afb6cce71a95c715e80edadff5 (diff)
stdio: Fix issue of printing "%La" format with large exp part.
- Currently, printf("%La\n", 1e1000L) crashes with segv due to lack of frexpl() function. With this patch, frexpl() function has been implemented in libm to solve this issue. Addresses: https://sourceware.org/pipermail/newlib/2021/018718.html
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/include/math.h1
-rw-r--r--newlib/libc/stdio/vfprintf.c5
-rw-r--r--newlib/libc/stdio/vfwprintf.c5
3 files changed, 3 insertions, 8 deletions
diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h
index 0b6494e6a..799ac494a 100644
--- a/newlib/libc/include/math.h
+++ b/newlib/libc/include/math.h
@@ -509,6 +509,7 @@ extern long double erfcl (long double);
#else /* !_LDBL_EQ_DBL && !__CYGWIN__ */
extern long double hypotl (long double, long double);
extern long double sqrtl (long double);
+extern long double frexpl (long double, int *);
#ifdef __i386__
/* Other long double precision functions. */
extern _LONG_DOUBLE rintl (_LONG_DOUBLE);
diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c
index 1aaf05aa4..c1483c0ac 100644
--- a/newlib/libc/stdio/vfprintf.c
+++ b/newlib/libc/stdio/vfprintf.c
@@ -517,10 +517,7 @@ extern int _ldcheck (_LONG_DOUBLE *);
# define _PRINTF_FLOAT_TYPE _LONG_DOUBLE
# define _DTOA_R _ldtoa_r
-/* FIXME - frexpl is not yet supported; and cvt infloops if (double)f
- converts a finite value into infinity. */
-/* # define FREXP frexpl */
-# define FREXP(f,e) ((_LONG_DOUBLE) frexp ((double)f, e))
+# define FREXP frexpl
# endif /* !_NO_LONGDBL */
static char *cvt(struct _reent *, _PRINTF_FLOAT_TYPE, int, int, char *, int *,
diff --git a/newlib/libc/stdio/vfwprintf.c b/newlib/libc/stdio/vfwprintf.c
index 980b31e3b..7384b37d3 100644
--- a/newlib/libc/stdio/vfwprintf.c
+++ b/newlib/libc/stdio/vfwprintf.c
@@ -243,10 +243,7 @@ extern int _ldcheck (_LONG_DOUBLE *);
# define _PRINTF_FLOAT_TYPE _LONG_DOUBLE
# define _DTOA_R _ldtoa_r
-/* FIXME - frexpl is not yet supported; and cvt infloops if (double)f
- converts a finite value into infinity. */
-/* # define FREXP frexpl */
-# define FREXP(f,e) ((_LONG_DOUBLE) frexp ((double)f, e))
+# define FREXP frexpl
# endif /* !_NO_LONGDBL */
static wchar_t *wcvt(struct _reent *, _PRINTF_FLOAT_TYPE, int, int, wchar_t *,