Commit Graph

6 Commits

Author SHA1 Message Date
Joseph Myers 667b3ec15d Update libquadmath fmaq from glibc, fix nanq issues.
This patch extends update-quadmath.py to update fmaq from glibc.

The issue in that function was that quadmath-imp.h had a struct in a
union with mant_high and mant_low fields (up to 64-bit) whereas glibc
has mantissa0, mantissa1, mantissa2 and mantissa3 (up to 32-bit).  The
patch changes those fields to be the same as in glibc, moving printf /
strtod code that also uses those fields back to closer to the glibc
form.  This allows fmaq to be updated automatically from glibc (which
brings in at least one bug fix from glibc from 2015).

nanq was also using the mant_high field name, and had other issues: it
only partly initialized the union from which a value was returned, and
setting mant_high to 1 meant a signaling NaN would be returned rather
than a quiet NaN.  This patch fixes those issues as part of updating
it to use the changed interfaces (but does not fix the issue of not
using the argument).

Bootstrapped with no regressions on x86_64-pc-linux-gnu.

	* quadmath-imp.h (ieee854_float128): Use mantissa0, mantissa1,
	mantissa2 and mantissa3 fields instead of mant_high and mant_low.
	Change nan field to ieee_nan.
	* update-quadmath.py (update_sources): Also update fmaq.c.
	* math/nanq.c (nanq): Use ieee_nan field of union.
	Zero-initialize f.  Set quiet_nan field.
	* printf/flt1282mpn.c, printf/printf_fphex.c, strtod/mpn2flt128.c,
	strtod/strtoflt128.c: Use mantissa0, mantissa1, mantissa2 and
	mantissa3 fields.  Use ieee_nan and quiet_nan field.
	* math/fmaq.c: Regenerate from glibc sources with
	update-quadmath.py.

From-SVN: r265874
2018-11-07 13:49:03 +00:00
Richard Sandiford 1b78544ffe Revert libquadmath and libssp copyright patches.
From-SVN: r195820
2013-02-06 22:03:54 +00:00
Richard Sandiford 1a41c323b0 Update copyright in libquadmath.
From-SVN: r195699
2013-02-03 17:49:30 +00:00
Tobias Burnus 05abb346d6 quadmath-rounding-mode.h: New.
2012-11-23  Tobias Burnus  <burnus@net-b.de>
            Joseph Myers  <joseph@codesourcery.com>

        * quadmath-rounding-mode.h: New.
        * printf/fpioconst.c: Update from GLIBC. Fix strtod rounding.
        * printf/fpioconst.h: Ditto.
        * printf/printf_fp.c (__quadmath_printf_fp): Update from GLIBC.
        Make printf respect the rounding mode for decimal output.
        * printf/printf_fphex.c (__quadmath_printf_fphex): Update from
        GLIBC.  Make printf respect the rounding mode for hex output.
        * strtod/strtod_l.c: Update from GLIBC. Make strtod respect the
        rounding mode. Fix strtod handling of underflow.


Co-Authored-By: Joseph Myers <joseph@codesourcery.com>

From-SVN: r193770
2012-11-23 23:11:40 +01:00
Jakub Jelinek d2995f2185 quadmath-printf.c: Also check __GLIBC__ when checking whether workarounds for printf hook handling...
* printf/quadmath-printf.c: Also check __GLIBC__ when checking
	whether workarounds for printf hook handling should be added.

	* configure.ac: Check for locale.h too.
	(USE_LOCALE_SUPPORT): Remove check.
	(USE_NL_LANGINFO, USE_NL_LANGINFO_WC, USE_LOCALECONV): New checks.
	(USE_I18_NUMBER_H): Check also for _NL_CTYPE_MB_CUR_MAX.
	* printf/printf_fphex.c (__quadmath_printf_fphex): Use nl_langinfo
	or localeconv for narrow version and nl_langinfo if USE_NL_LANGINFO_WC
	for wide version.
	* printf/quadmath-printf.h: Include locale.h if HAVE_LOCALE_H.
	* printf/printf_fp.c (USE_I18N_NUMBER_H): Don't define to 0.
	(__quadmath_printf_fp): Use nl_langinfo or localeconv for narrow
	version and nl_langinfo if USE_NL_LANGINFO_WC for wide version.
	Guard nl_langinfo (_NL_CTYPE_MB_CUR_MAX) use with
	USE_I18N_NUMBER_H #ifdef.
	* configure: Regenerated.
	* config.h.in: Regenerated.

From-SVN: r170211
2011-02-16 14:54:30 +01:00
Jakub Jelinek 1d92226be3 re PR fortran/47642 (real(kind=16) - libquadmath - segfault on amd64 FreeBSD)
PR fortran/47642
	* libquadmath.texi (quadmath_snprintf): Document.
	(quadmath_flt128tostr): Remove.
	* Makefile.am (libquadmath_la_SOURCES): Add printf/*.c.
	Remove  quadmath_io.c, gdtoa/gdtoa.c, gdtoa/g__fmt.c,
	gdtoa/g_Qfmt.c, gdtoa/dmisc.c and gdtoa/ulp.c.
	* quadmath.h (quadmath_snprintf): New prototype.
	(quadmath_flt128tostr): Remove.
	* quadmath_weak.h (quadmath_snprintf): Add.
	(quadmath_flt128tostr): Remove.
	* configure.ac: New AC_CHECK_HEADERS headers: langinfo.h, wchar.h,
	wctype.h, limits.h, ctype.h, printf.h, errno.h.
	(AC_USE_SYSTEM_EXTENSIONS): Add.
	(HAVE_HIDDEN_VISIBILITY, HAVE_PRINTF_HOOKS,
	USE_LOCALE_SUPPORT, USE_I18N_NUMBER_H): New checks.
	* quadmath.map (QUADMATH_1.0): Add quadmath_snprintf.  Remove
	quadmath_flt128tostr.
	* printf/printf_fphex.c: New file.
	* printf/_itowa.h: New file.
	* printf/mul_n.c: New file.
	* printf/quadmath-printf.h: New file.
	* printf/submul_1.c: New file.
	* printf/quadmath-printf.c: New file.
	* printf/gmp-impl.h: New file.
	* printf/lshift.c: New file.
	* printf/fpioconst.h: New file.
	* printf/add_n.c: New file.
	* printf/cmp.c: New file.
	* printf/sub_n.c: New file.
	* printf/mul.c: New file.
	* printf/divrem.c: New file.
	* printf/addmul_1.c: New file.
	* printf/printf_fp.c: New file.
	* printf/_itoa.h: New file.
	* printf/fpioconst.c: New file.
	* printf/_i18n_number.h: New file.
	* printf/flt1282mpn.c: New file.
	* printf/rshift.c: New file.
	* printf/mul_1.c: New file.
	* quadmath_io.c: Removed.
	* gdtoa/gdtoa.c: Removed.
	* gdtoa/g__fmt.c: Removed.
	* gdtoa/g_Qfmt.c: Removed.
	* gdtoa/dmisc.c: Removed.
	* gdtoa/ulp.c: Removed.
	* config.h.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.

	* io/write_float.def (DTOAQ): Use quadmath_snprintf instead of
	quadmath_flt128tostr.
	* io/transfer128.c (tmp2): Initialize to quadmath_snprintf instead
	of quadmath_flt128tostr.

From-SVN: r170135
2011-02-14 16:34:44 +01:00