diff options
author | Takashi Yano <takashi.yano@nifty.ne.jp> | 2021-11-29 21:56:46 +0900 |
---|---|---|
committer | Takashi Yano <takashi.yano@nifty.ne.jp> | 2021-11-29 22:51:16 +0900 |
commit | 48f6c59332ee2970cd4b172278176dcfe32a328d (patch) | |
tree | 958c95110c5543b1e8f04b9b662fc21b4dcf706d /newlib/libc | |
parent | 3502a6ff2e2740afb6cce71a95c715e80edadff5 (diff) | |
download | newlib-48f6c59332ee2970cd4b172278176dcfe32a328d.zip newlib-48f6c59332ee2970cd4b172278176dcfe32a328d.tar.gz newlib-48f6c59332ee2970cd4b172278176dcfe32a328d.tar.bz2 |
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.h | 1 | ||||
-rw-r--r-- | newlib/libc/stdio/vfprintf.c | 5 | ||||
-rw-r--r-- | newlib/libc/stdio/vfwprintf.c | 5 |
3 files changed, 3 insertions, 8 deletions
diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h index 0b6494e..799ac49 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 1aaf05a..c1483c0 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 980b31e..7384b37 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 *, |