summary refs log tree commit diff
path: root/NEWS
Commit message (Collapse)AuthorAgeFilesLines
* nss_nis: Do not call malloc_usable_size [BZ #10432]Florian Weimer2015-10-061-10/+10
| | | | | This is a namespace violation, and interposed malloc implementations are not required to interpose malloc_usable_size.
* Harden tls_dtor_list with pointer mangling [BZ #19018]Florian Weimer2015-10-061-2/+2
|
* Fix BZ #19012 -- iconv_open leaks memory on error path.Paul Pluzhnikov2015-10-051-2/+2
|
* Fix ldbl-96 lroundl just below powers of 2 (bug 19071).Joseph Myers2015-10-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ldbl-96 version of lroundl is incorrect for systems with 64-bit long when the argument's absolute value is just below a power of 2, 2^32 or more, and rounds up to the next integer; in such cases, it returns 0. The problem is incrementing the high part of the mantissa loses the high bit of the value (which is not an issue for any other floating-point format, and is handled specially in lround when the bit corresponding to 0.5 was in the high part rather than the low part). This patch fixes this in a similar way to that used in llroundl: storing the high part in an unsigned long variable before incrementing it, so problems cannot occur in the case when this code is reachable. I improved test coverage for both lround and llround by making them use the same test inputs (appropriately conditioned on the size of long in the lround case) - complete with the same comments, to make comparison as easy as possible. (This test coverage improvement was how I found the lroundl bug.) Tested for x86_64 and x86. [BZ #19071] * sysdeps/ieee754/ldbl-96/s_lroundl.c (__lroundl): Use unsigned long int variable to store possibly incremented high part of mantissa. * math/libm-test.inc (lround_test_data): Add tests used for llround. Use [LONG_MAX > 0x7fffffff] consistently as condition for tests requiring 64-bit long. Do not condition tests on [TEST_FLOAT] unnecessarily. (llround_test_data): Add tests used for lround. Add another expectation for the "inexact" exception. Do not condition tests on [TEST_FLOAT] unnecessarily.
* Don't list bug 887 as fixed for glibc 2.16.Joseph Myers2015-10-051-23/+23
|
* Work around powerpc32 integer 0 converting to -0 (bug 887, bug 19049, bug ↵Joseph Myers2015-10-051-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 19050). On powerpc32 hard-float, older processors (ones where fcfid is not available for 32-bit code), GCC generates conversions from integers to floating point that wrongly convert integer 0 to -0 instead of +0 in FE_DOWNWARD mode. This in turn results in logb and a few other functions wrongly returning -0 when they should return +0. This patch works around this issue in glibc as I proposed in <https://sourceware.org/ml/libc-alpha/2015-09/msg00728.html>, so that the affected functions can be correct and the affected tests pass in the absence of a GCC fix for this longstanding issue (GCC bug 67771 - if fixed, of course we can put in GCC version conditionals, and eventually phase out the workarounds). A new macro FIX_INT_FP_CONVERT_ZERO is added in a new sysdeps header fix-int-fp-convert-zero.h, and the powerpc32/fpu version of that header defines the macro based on the results of a configure test for whether such conversions use the fcfid instruction. Tested for x86_64 (that installed stripped shared libraries are unchanged by the patch) and powerpc (that HAVE_PPC_FCFID comes out to 0 as expected and that the relevant tests are fixed). Also tested a build with GCC configured for -mcpu=power4 and verified that HAVE_PPC_FCFID comes out to 1 in that case. There are still some other issues to fix to get test-float and test-double passing cleanly for older powerpc32 processors (apart from the need for an ulps regeneration for powerpc). (test-ldouble will be harder to get passing cleanly, but with a combination of selected fixes to ldbl-128ibm code that don't involve significant performance issues, allowing spurious underflow and inexact exceptions for that format, and lots of XFAILing for the default case of unpatched libgcc, it should be doable.) [BZ #887] [BZ #19049] [BZ #19050] * sysdeps/generic/fix-int-fp-convert-zero.h: New file. * sysdeps/ieee754/dbl-64/e_log10.c: Include <fix-int-fp-convert-zero.h>. (__ieee754_log10): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/ieee754/dbl-64/e_log2.c: Include <fix-int-fp-convert-zero.h>. (__ieee754_log2): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/ieee754/dbl-64/s_erf.c: Include <fix-int-fp-convert-zero.h>. (__erfc): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/ieee754/dbl-64/s_logb.c: Include <fix-int-fp-convert-zero.h>. (__logb): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/ieee754/flt-32/e_log10f.c: Include <fix-int-fp-convert-zero.h>. (__ieee754_log10f): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/ieee754/flt-32/e_log2f.c: Include <fix-int-fp-convert-zero.h>. (__ieee754_log2f): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/ieee754/flt-32/s_erff.c: Include <fix-int-fp-convert-zero.h>. (__erfcf): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/ieee754/flt-32/s_logbf.c: Include <fix-int-fp-convert-zero.h>. (__logbf): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/ieee754/ldbl-128ibm/s_erfl.c: Include <fix-int-fp-convert-zero.h>. (__erfcl): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/ieee754/ldbl-128ibm/s_logbl.c: Include <fix-int-fp-convert-zero.h>. (__logbl): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO. * sysdeps/powerpc/powerpc32/fpu/configure.ac: New file. * sysdeps/powerpc/powerpc32/fpu/configure: New generated file. * sysdeps/powerpc/powerpc32/fpu/fix-int-fp-convert-zero.h: New file. * config.h.in [_LIBC] (HAVE_PPC_FCFID): New macro.
* Fix nexttoward overflow in non-default rounding modes (bug 19059).Joseph Myers2015-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ISO C requires overflowing results from nexttoward to be the appropriate infinity independent of the rounding mode, but some implementations use a rounding-mode-dependent result (this is the same issue as was fixed for nextafter in bug 16677). This patch fixes the problem by making the nexttoward implementations discard the result from the floating-point computation that forced an overflow exception and then return the infinity previously computed with integer arithmetic. Tested for x86_64, x86, mips64 and powerpc. [BZ #19059] * math/s_nexttowardf.c (__nexttowardf): Do not return value from overflowing computation. * sysdeps/i386/fpu/s_nexttoward.c (__nexttoward): Likewise. * sysdeps/i386/fpu/s_nexttowardf.c (__nexttowardf): Likewise. * sysdeps/ieee754/ldbl-128/s_nexttoward.c (__nexttoward): Likewise. * sysdeps/ieee754/ldbl-128/s_nexttowardf.c (__nexttowardf): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c (__nexttoward): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c (__nexttowardf): Likewise. * sysdeps/ieee754/ldbl-96/s_nexttoward.c (__nexttoward): Likewise. * sysdeps/ieee754/ldbl-96/s_nexttowardf.c (__nexttowardf): Likewise. * sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c (__nldbl_nexttowardf): Likewise. * math/libm-test.inc (nexttoward_test_data): Add more tests.
* Harden putpwent, putgrent, putspent, putspent against injection [BZ #18724]Florian Weimer2015-10-021-5/+5
| | | | | | | | | | | This prevents injection of ':' and '\n' into output functions which use the NSS files database syntax. Critical fields (user/group names and file system paths) are checked strictly. For backwards compatibility, the GECOS field is rewritten instead. The getent program is adjusted to use the put*ent functions in libc, instead of local copies. This changes the behavior of getent if user names start with '-' or '+'.
* Fix ldbl-128 / ldbl-128ibm lgamma overflow handling (bug 16347, bug 19046).Joseph Myers2015-10-011-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ldbl-128 / ldbl-128ibm implementation of lgamma has problems with its handling of large arguments. It has an overflow threshold that is correct only for ldbl-128, despite being used for both types - with diagnostic control macros as a temporary measure to disable warnings about that constant overflowing for ldbl-128ibm - and it has a calculation that's roughly x * log(x) - x, resulting in overflows for arguments that are roughly at most a factor 1/log(threshold) below the overflow threshold. This patch fixes both issues, using an overflow threshold appropriate for the type in question and adding another case for large arguments that avoids the possible intermediate overflow. Tested for x86_64, x86, mips64 and powerpc. [BZ #16347] [BZ #19046] * sysdeps/ieee754/ldbl-128/e_lgammal_r.c: Do not include <libc-internal.h>. (MAXLGM): Do not use diagnostic control macros. [LDBL_MANT_DIG == 106] (MAXLGM): Change value to overflow threshold for ldbl-128ibm. (__ieee754_lgammal_r): For large arguments, multiply by log - 1 instead of multiplying by log then subtracting. * math/auto-libm-test-in: Add more tests of lgamma. * math/auto-libm-test-out: Regenerated.
* Fix ldbl-128ibm exp10l spurious overflows (bug 16620).Joseph Myers2015-09-301-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | The ldbl-128ibm implementation of exp10l uses a version of log(10) split into high and low parts - but the low part is negative, so causing spurious overflows from __ieee754_expl (exp_high) in cases close to the overflow threshold (I added relevant tests close to the overflow threshold to the testsuite earlier today). The same issue applies close to the underflow threshold as well (except that spurious underflows in IBM long double arithmetic are harder to fix than the other deficiencies, so we might end up permitting those for IBM long double in the libm testsuite, as permitted by ISO C). This patch fixes it to use a low part rounded downward to 48 bits instead. (The choice of 48 instead of 53 bits is to make it more obviously safe even when the low part of the argument is negative.) Tested for powerpc. (Note that because of libgcc bugs with multiplication very close to LDBL_MAX, libgcc also needs patching for all the problem cases to be fixed, but this patch is still safe and correct in the absence of such libgcc fixes.) [BZ #16620] * sysdeps/ieee754/ldbl-128ibm/e_exp10l.c (log10_high): Use value of log (10) rounded downward to 48 bits. (log10_low): Use corresponding low part of log (10).
* Fix i386 acosh (-qNaN) spurious "invalid" exception.Joseph Myers2015-09-301-1/+1
| | | | | | | | | | | | | | | | | | The i386 versions of acoshf and acosh raise a spurious "invalid" exception for an argument that is a quiet NaN with the sign bit set. The integer arithmetic to detect arguments < 1 also detects -NaN, and then the computation 0 / 0 in that case raises the exception. This patch fixes this by using (x - x) / (x - x) as the computation in that case instead, which will always raise the exception for non-NaN arguments reaching that code, but not for quiet NaN arguments. Tested for x86_64 and x86. [BZ #19032] * sysdeps/i386/fpu/e_acosh.S (__ieee754_acosh): For arguments < 1, compute result as (x - x) / (x - x) not as 0 / 0. * sysdeps/i386/fpu/e_acoshf.S (__ieee754_acoshf): Likewise. * math/libm-test.inc (acosh_test_data): Add another test of acosh.
* Fix clog, clog10 inaccuracy (bug 19016).Joseph Myers2015-09-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For arguments with X^2 + Y^2 close to 1, clog and clog10 avoid large errors from log(hypot) by computing X^2 + Y^2 - 1 in a way that avoids cancellation error and then using log1p. However, the thresholds for using that approach still result in log being used on argument as large as sqrt(13/16) > 0.9, leading to significant errors, in some cases above the 9ulp maximum allowed in glibc libm. This patch arranges for the approach using log1p to be used in any cases where |X|, |Y| < 1 and X^2 + Y^2 >= 0.5 (with the existing allowance for cases where one of X and Y is very small), adjusting the __x2y2m1 functions to work with the wider range of inputs. This way, log only gets used on arguments below sqrt(1/2) (or substantially above 1), where the error involved is much less. Tested for x86_64, x86, mips64 and powerpc. For the ulps regeneration I removed the existing clog and clog10 ulps before regenerating to allow any reduced ulps to appear. Tests added include those found by random test generation to produce large ulps either before or after the patch, and some found by trying inputs close to the (0.75, 0.5) threshold where the potential errors from using log are largest. [BZ #19016] * sysdeps/generic/math_private.h (__x2y2m1f): Update comment to allow more cases with X^2 + Y^2 >= 0.5. * sysdeps/ieee754/dbl-64/x2y2m1.c (__x2y2m1): Likewise. Add -1 as normal element in sum instead of special-casing based on values of arguments. * sysdeps/ieee754/dbl-64/x2y2m1f.c (__x2y2m1f): Update comment. * sysdeps/ieee754/ldbl-128/x2y2m1l.c (__x2y2m1l): Likewise. Add -1 as normal element in sum instead of special-casing based on values of arguments. * sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c (__x2y2m1l): Likewise. * sysdeps/ieee754/ldbl-96/x2y2m1.c [FLT_EVAL_METHOD != 0] (__x2y2m1): Update comment. * sysdeps/ieee754/ldbl-96/x2y2m1l.c (__x2y2m1l): Likewise. Add -1 as normal element in sum instead of special-casing based on values of arguments. * math/s_clog.c (__clog): Handle more cases using log1p without hypot. * math/s_clog10.c (__clog10): Likewise. * math/s_clog10f.c (__clog10f): Likewise. * math/s_clog10l.c (__clog10l): Likewise. * math/s_clogf.c (__clogf): Likewise. * math/s_clogl.c (__clogl): Likewise. * math/auto-libm-test-in: Add more tests of clog and clog10. * math/auto-libm-test-out: Regenerated. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* Let 'make check subdirs=string' succeed even when it's invokedMartin Sebor2015-09-281-1/+1
| | | | | immediately after glibc has been built and before 'make check' (or after 'make clean').
* Fix BZ #18985 -- out of range data to strftime() causes a segfaultPaul Pluzhnikov2015-09-261-1/+1
|
* Fix powf inaccuracy (bug 18956).Joseph Myers2015-09-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | The flt-32 version of powf can be inaccurate because of bugs in the extra-precision calculation of (x-1)/(x+1) or (x-1.5)/(x+1.5) as part of calculating log(x) with extra precision: a constant used (as part of adding 1 or 1.5 through integer arithmetic) is incorrect, and then the code fails to mask a computed high part before using it in arithmetic that relies on s_h*t_h being exactly representable. This patch fixes these bugs. Tested for x86_64 and x86. x86_64 ulps for powf removed and regenerated to reflect reduced ulps from the increased accuracy for existing tests. [BZ #18956] * sysdeps/ieee754/flt-32/e_powf.c (__ieee754_powf): Add 0x00400000 not 0x0040000 for high bit of mantissa. Mask with 0xfffff000 when extracting high part. * math/auto-libm-test-in: Add another test of pow. * math/auto-libm-test-out: Regenerated. * sysdeps/x86_64/fpu/libm-test-ulps: Update.
* Fix pow missing underflows (bug 18825).Joseph Myers2015-09-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to various other bugs in this area, pow functions can fail to raise the underflow exception when the result is tiny and inexact but one or more low bits of the intermediate result that is scaled down (or, in the i386 case, converted from a wider evaluation format) are zero. This patch forces the exception in a similar way to previous fixes, thereby concluding the fixes for known bugs with missing underflow exceptions currently filed in Bugzilla. Tested for x86_64, x86, mips64 and powerpc. [BZ #18825] * sysdeps/i386/fpu/i386-math-asm.h (FLT_NARROW_EVAL_UFLOW_NONNAN): New macro. (DBL_NARROW_EVAL_UFLOW_NONNAN): Likewise. (LDBL_CHECK_FORCE_UFLOW_NONNAN): Likewise. * sysdeps/i386/fpu/e_pow.S: Use DEFINE_DBL_MIN. (__ieee754_pow): Use DBL_NARROW_EVAL_UFLOW_NONNAN instead of DBL_NARROW_EVAL, reloading the PIC register as needed. * sysdeps/i386/fpu/e_powf.S: Use DEFINE_FLT_MIN. (__ieee754_powf): Use FLT_NARROW_EVAL_UFLOW_NONNAN instead of FLT_NARROW_EVAL. Use separate return path for case when first argument is NaN. * sysdeps/i386/fpu/e_powl.S: Include <i386-math-asm.h>. Use DEFINE_LDBL_MIN. (__ieee754_powl): Use LDBL_CHECK_FORCE_UFLOW_NONNAN, reloading the PIC register. * sysdeps/ieee754/dbl-64/e_pow.c (__ieee754_pow): Use math_check_force_underflow_nonneg. * sysdeps/ieee754/flt-32/e_powf.c (__ieee754_powf): Force underflow for subnormal result. * sysdeps/ieee754/ldbl-128/e_powl.c (__ieee754_powl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_powl.c (__ieee754_powl): Use math_check_force_underflow_nonneg. * sysdeps/x86/fpu/powl_helper.c (__powl_helper): Use math_check_force_underflow. * sysdeps/x86_64/fpu/x86_64-math-asm.h (LDBL_CHECK_FORCE_UFLOW_NONNAN): New macro. * sysdeps/x86_64/fpu/e_powl.S: Include <x86_64-math-asm.h>. Use DEFINE_LDBL_MIN. (__ieee754_powl): Use LDBL_CHECK_FORCE_UFLOW_NONNAN. * math/auto-libm-test-in: Add more tests of pow. * math/auto-libm-test-out: Regenerated.
* [BZ #17250] Fix static dlopen default library search pathMaciej W. Rozycki2015-09-251-6/+6
| | | | | | | | | | Fix a regression introduced with commit 0d23a5c1 [Static dlopen correction fallout fixes] that caused the default library search path to be ignored for modules loaded with dlopen from static executables. [BZ #17250] * elf/dl-support.c (_dl_main_map): Don't initialize l_flags_1 member.
* Fix hypot missing underflows (bug 18803).Joseph Myers2015-09-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to various other bugs in this area, hypot functions can fail to raise the underflow exception when the result is tiny and inexact but one or more low bits of the intermediate result that is scaled down (or, in the i386 case, converted from a wider evaluation format) are zero. This patch forces the exception in a similar way to previous fixes. Note that this issue cannot arise for implementations of hypotf using double (or wider) for intermediate evaluation (if hypotf should underflow, that means the double square root is being computed of some number of the form N*2^-298, for 0 < N < 2^46, which is exactly represented as a double, and whatever the rounding mode such a square root cannot have a mantissa with all zeroes after the initial 23 bits). Thus no changes are made to hypotf implementations in this patch, only to hypot and hypotl. Tested for x86_64, x86, mips64 and powerpc. [BZ #18803] * sysdeps/i386/fpu/e_hypot.S: Use DEFINE_DBL_MIN. (MO): New macro. (__ieee754_hypot) [PIC]: Load PIC register. (__ieee754_hypot): Use DBL_NARROW_EVAL_UFLOW_NONNEG instead of DBL_NARROW_EVAL. * sysdeps/ieee754/dbl-64/e_hypot.c (__ieee754_hypot): Use math_check_force_underflow_nonneg in case where result might be tiny. * sysdeps/ieee754/ldbl-128/e_hypotl.c (__ieee754_hypotl): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_hypotl.c (__ieee754_hypotl): Likewise. * sysdeps/ieee754/ldbl-96/e_hypotl.c (__ieee754_hypotl): Likewise. * sysdeps/powerpc/fpu/e_hypot.c (__ieee754_hypot): Likewise. * math/auto-libm-test-in: Add more tests of hypot. * math/auto-libm-test-out: Regenerated.
* Fix x86_64 fma4 pow inappropriate contraction (bug 19003).Joseph Myers2015-09-241-1/+1
| | | | | | | | | | | | | | | | The x86_64 fma4 version of pow fails to disable contraction of operations other than those explicitly intended to use fma instructions, so resulting in large ulps errors on processors with fma4 instructions, as in bug 18104 (165ulp for the test added for that bug; error originally reported by "blaaa" on #glibc). This patch adds $(config-cflags-nofma) for e_pow-fma4.c, corresponding to the use for e_pow.c in sysdeps/ieee754/dbl-64/Makefile. Tested for x86_64 on a processor with fma4. [BZ #19003] * sysdeps/x86_64/fpu/multiarch/Makefile (CFLAGS-e_pow-fma4.c): Add $(config-cflags-nofma).
* Avoid excess range in results from i386 exp, hypot, pow functions (bug 18980).Joseph Myers2015-09-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | i386 exp, hypot and pow functions can return overflowing and underflowing values with excess range and precision; ; Wilco Dijkstra's patches to make isfinite etc. expand inline cause this pre-existing issue to result in test failures. This patch fixes those functions to avoid excess range and precision in their return values. Appropriate macros are added for the repeated code sequences; in future I'll add more such macros and refactor existing code forcing underflow (with or without also eliminating excess range and precision from the return value) to use such macros. Tested for x86. If, after this patch, you still see x86 libm test failures with excess range or precision, please file bugs in Bugzilla. [BZ #18980] * sysdeps/i386/fpu/i386-math-asm.h (DEFINE_FLT_MIN): New macro. (DEFINE_DBL_MIN): Likewise. (FLT_NARROW_EVAL_UFLOW_NONNEG_NAN): Likewise. (DBL_NARROW_EVAL_UFLOW_NONNEG_NAN): Likewise. (FLT_NARROW_EVAL_UFLOW_NONNEG): Likewise. (DBL_NARROW_EVAL_UFLOW_NONNEG): Likewise. * sysdeps/i386/fpu/e_exp.S: Include <i386-math-asm.h>. (dbl_min): Replace with use of DEFINE_DBL_MIN. (__ieee754_exp): Use DBL_NARROW_EVAL_UFLOW_NONNEG_NAN. (__exp_finite): Use DBL_NARROW_EVAL_UFLOW_NONNEG. * sysdeps/i386/fpu/e_exp10.S: Include <i386-math-asm.h>. (dbl_min): Replace with use of DEFINE_DBL_MIN. (__ieee754_exp10): Use DBL_NARROW_EVAL_UFLOW_NONNEG_NAN. * sysdeps/i386/fpu/e_exp10f.S: Include <i386-math-asm.h>. (flt_min): Replace with use of DEFINE_FLT_MIN. (__ieee754_exp10f): Use FLT_NARROW_EVAL_UFLOW_NONNEG_NAN. * sysdeps/i386/fpu/e_exp2.S: Include <i386-math-asm.h>. (dbl_min): Replace with use of DEFINE_DBL_MIN. (__ieee754_exp2): Use DBL_NARROW_EVAL_UFLOW_NONNEG_NAN. * sysdeps/i386/fpu/e_exp2f.S: Include <i386-math-asm.h>. (flt_min): Replace with use of DEFINE_FLT_MIN. (__ieee754_exp2f): Use FLT_NARROW_EVAL_UFLOW_NONNEG_NAN. * sysdeps/i386/fpu/e_expf.S: Include <i386-math-asm.h>. (flt_min): Replace with use of DEFINE_FLT_MIN. (__ieee754_expf): Use FLT_NARROW_EVAL_UFLOW_NONNEG_NAN. (__expf_finite): Use FLT_NARROW_EVAL_UFLOW_NONNEG. * sysdeps/i386/fpu/e_hypot.S: Include <i386-math-asm.h>. (__ieee754_hypot): Use DBL_NARROW_EVAL. * sysdeps/i386/fpu/e_hypotf.S: Include <i386-math-asm.h>. (__ieee754_hypotf): Use FLT_NARROW_EVAL. * sysdeps/i386/fpu/e_pow.S: Include <i386-math-asm.h>. (__ieee754_pow): Use DBL_NARROW_EVAL. * sysdeps/i386/fpu/e_powf.S: Include <i386-math-asm.h>. (__ieee754_powf): Use FLT_NARROW_EVAL. * sysdeps/i386/i686/fpu/multiarch/e_expf-sse2.S (__ieee754_expf_sse2): Convert double-precision result to single precision. * sysdeps/i386/fpu/libm-test-ulps: Update.
* Avoid excess range in results from i386 scalb functions (bug 18981).Joseph Myers2015-09-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | i386 scalb / scalbn / scalbln (and thus ldexp) functions for float and double can return results with excess range (and consequently excess precision for subnormal results). As the results of these functions are fully determined by reference to IEEE 754 operations, this is unambiguously a bug, apart from the testsuite failures it causes. This patch makes those functions store their results on the stack and load them back to eliminate the excess range. Double rounding is not a problem, as the only cases where it could occur are when the result overflows or underflows for extended precision, and then the double-rounded results are the same as the single-rounded results. The new macros will be used for more functions, more such macros added, and existing code refactored to use such macros, in subsequent patches. Tested for x86. Committed. [BZ #18981] * sysdeps/i386/fpu/i386-math-asm.h: New file. * sysdeps/i386/fpu/e_scalb.S: Include <i386-math-asm.h>. (__ieee754_scalb): Use DBL_NARROW_EVAL. * sysdeps/i386/fpu/e_scalbf.S: Include <i386-math-asm.h>. (__ieee754_scalbf): Use FLT_NARROW_EVAL. * sysdeps/i386/fpu/s_scalbn.S: Include <i386-math-asm.h>. (__scalbn): Use DBL_NARROW_EVAL. * sysdeps/i386/fpu/s_scalbnf.S: Include <i386-math-asm.h>. (__scalbnf): Use FLT_NARROW_EVAL.
* Add inlining of the C99 math functions ↵Wilco Dijkstra2015-09-181-7/+8
| | | | | | | | | | | | | | | | | | | | | isinf/isnan/signbit/isfinite/isnormal/fpclassify using GCC built-ins when available. Since going through the PLT is expensive for these small functions, inlining results in major speedups (about 7x on Cortex-A57 for isinf). The GCC built-ins are not correct if signalling NaN support is required, and thus are turned off in that case (see GCC bug 66462). The test-snan.c tests sNaNs and so must be explicitly built with -fsignaling-nans. 2015-09-18 Wilco Dijkstra <wdijkstr@arm.com> [BZ #15367] [BZ #17441] * math/Makefile: Build test-snan.c with -fsignaling-nans. * math/math.h (fpclassify): Use __builtin_fpclassify when available. (signbit): Use __builtin_signbit(f/l). (isfinite): Use__builtin_isfinite. (isnormal): Use __builtin_isnormal. (isnan): Use __builtin_isnan. (isinf): Use __builtin_isinf_sign.
* time: in strptime(), make %z accept [+-]HH:MM tz [BZ #17887]Vincent Bernat2015-09-181-5/+5
| | | | | | In ISO 8601, +03:30 is a valid time zone. Currently, strptime() only parses it as a 2-digit time zone an believes this is +03:00. This change makes it accept a single colon.
* time: in strptime(), make %z accept Z as a time zone [BZ #17886]Vincent Bernat2015-09-181-5/+5
| | | | | | In ISO 8601, the timezone can be 'Z' instead of using digits. 2014-08-17T12:33:12+0000 is often expressed as 2014-08-17T12:33:12Z.
* Use __pthread_setcancelstate in libc.aH.J. Lu2015-09-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch references __pthread_setcancelstate instead of pthread_setcancelstate in libc.a. [BZ #18970] * misc/error.c (error): Replace pthread_setcancelstate with __pthread_setcancelstate. (error_at_line): Likewise. * posix/wordexp.c (parse_comm): Likewise. * stdlib/fmtmsg.c (fmtmsg): Likewise. * nptl/forward.c (pthread_setcancelstate): Renamed to ... (__pthread_setcancelstate): This. (pthread_setcancelstate): Add an alias. * nptl/nptl-init.c (pthread_functions): Replace ptr_pthread_setcancelstate with ptr___pthread_setcancelstate. * sysdeps/nptl/pthread-functions.h (pthread_functions): Likewise. * nptl/pthreadP.h (__pthread_setcancelstate): Mark it with hidden_proto. * nptl/pthread_setcancelstate.c (__pthread_setcancelstate): Mark it with hidden_def. * sysdeps/nptl/libc-lockP.h (__pthread_setcancelstate): New. (pthread_setcancelstate): Renamed to ... (__pthread_setcancelstate): This. * sysdeps/unix/sysv/linux/fatal-prepare.h (FATAL_PREPARE): Use __libc_ptf_call with __pthread_setcancelstate.
* Fix sign of zero part from ctan / ctanh when argument infinite (bug 17118).Joseph Myers2015-09-171-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | C99/C11 Annex G specifies the sign of the zero part of the result of ctan (x +/- i * Inf) and ctanh (+/-Inf + i * y). This patch fixes glibc to follow that specification, along the lines I described in my review of Andreas's previous patch for this issue <https://sourceware.org/ml/libc-alpha/2014-08/msg00142.html>. Tested for x86_64. 2015-09-17 Joseph Myers <joseph@codesourcery.com> Andreas Schwab <schwab@suse.de> [BZ #17118] * math/s_ctan.c (__ctan): Determine sign of zero real part of result when imaginary part of argument is infinite using sine and cosine. * math/s_ctanf.c (__ctanf): Likewise. * math/s_ctanl.c (__ctanl): Likewise. * math/s_ctanh.c (__ctanh): Determine sign of zero imaginary part of result when real part of argument is infinite using sine and cosine. * math/s_ctanhf.c (__ctanhf): Likewise. * math/s_ctanhl.c (__ctanhl): Likewise. * math/libm-test.inc (ctan_test_data): Add more tests of ctan. (ctanh_test_data): Add more tests of ctanh.
* Reduce number of constants in __finite* (bug 15384).Joseph Myers2015-09-171-7/+7
| | | | | | | | | | | | | | | | | | | Bug 15384 notes that in __finite, two different constants are used that could be the same constant (the result only depends on the exponent of the floating-point representation), and that using the same constant is better for architectures where constants need loading from a constant pool. This patch implements that change. Tested for x86_64, mips64 and powerpc. [BZ #15384] * sysdeps/ieee754/dbl-64/s_finite.c (FINITE): Use same constant as bit-mask as in subtraction. * sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c (__finite): Likewise. * sysdeps/ieee754/flt-32/s_finitef.c (FINITEF): Likewise. * sysdeps/ieee754/ldbl-128/s_finitel.c (__finitel): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_finitel.c (__finitel): Likewise.
* Fix tgamma missing underflows (bug 18951).Joseph Myers2015-09-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Similar to various other bugs in this area, tgamma functions can fail to raise the underflow exception when the result is tiny and inexact but one or more low bits of the intermediate result that is scaled down are zero. This patch forces the exception in a similar way to previous fixes. Tested for x86_64, x86, mips64 and powerpc. [BZ #18951] * sysdeps/ieee754/dbl-64/e_gamma_r.c (__ieee754_gamma_r): Force underflow exception for small results. * sysdeps/ieee754/flt-32/e_gammaf_r.c (__ieee754_gammaf_r): Likewise. * sysdeps/ieee754/ldbl-128/e_gammal_r.c (__ieee754_gammal_r): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c (__ieee754_gammal_r): Likewise. * sysdeps/ieee754/ldbl-96/e_gammal_r.c (__ieee754_gammal_r): Likewise. * math/auto-libm-test-in: Add more tests of tgamma. * math/auto-libm-test-out: Regenerated.
* Don't declare float / long double Bessel functions for XSI POSIX (bug 18977).Joseph Myers2015-09-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The float and long double versions of Bessel function (j0f, y1l, etc.) are not in POSIX; only the double versions are. This patch accordingly limits the declarations of those functions to __USE_MISC, and fixes the conform/ test expectations which matched the previous incorrect declarations. Tested for x86_64 and x86 (testsuite, and that installed stripped shared libraries are unchanged by this patch). [BZ #18977] * math/bits/mathcalls.h [!__USE_MISC && __USE_XOPEN && !__MATH_DECLARING_DOUBLE] (j0): Do not declare. [!__USE_MISC && __USE_XOPEN && !__MATH_DECLARING_DOUBLE] (j1): Likewise. [!__USE_MISC && __USE_XOPEN && !__MATH_DECLARING_DOUBLE] (jn): Likewise. [!__USE_MISC && __USE_XOPEN && !__MATH_DECLARING_DOUBLE] (y0): Likewise. [!__USE_MISC && __USE_XOPEN && !__MATH_DECLARING_DOUBLE] (y1): Likewise. [!__USE_MISC && __USE_XOPEN && !__MATH_DECLARING_DOUBLE] (yn): Likewise. * conform/data/math.h-data [!ISO99 && !ISO11 && !POSIX && !POSIX2008] (j0f): Do not expect function. [!ISO99 && !ISO11 && !POSIX && !POSIX2008] (j1f): Likewise. [!ISO99 && !ISO11 && !POSIX && !POSIX2008] (jnf): Likewise. [!ISO99 && !ISO11 && !POSIX && !POSIX2008] (y0f): Likewise. [!ISO99 && !ISO11 && !POSIX && !POSIX2008] (y1f): Likewise. [!ISO99 && !ISO11 && !POSIX && !POSIX2008] (ynf): Likewise. [!ISO99 && !ISO11 && !POSIX && !POSIX2008] (j0l): Likewise. [!ISO99 && !ISO11 && !POSIX && !POSIX2008] (j1l): Likewise. [!ISO99 && !ISO11 && !POSIX && !POSIX2008] (jnl): Likewise. [!ISO99 && !ISO11 && !POSIX && !POSIX2008] (y0l): Likewise. [!ISO99 && !ISO11 && !POSIX && !POSIX2008] (y1l): Likewise. [!ISO99 && !ISO11 && !POSIX && !POSIX2008] (ynl): Likewise.
* Make scalbn set errno (bug 6803).Joseph Myers2015-09-161-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As noted in bug 6803, scalbn fails to set errno on overflow and underflow. This patch fixes this by making scalbn an alias of ldexp, which has exactly the same semantics (for floating-point types with radix 2) and already has wrappers that deal with setting errno, instead of an alias of the internal __scalbn (which ldexp calls). Notes: * Where compat symbols were defined for scalbn functions, I didn't change what they point to (to keep the patch minimal), so such compat symbols continue to go directly to the non-errno-setting functions. * Mike, I didn't do anything with the IA64 versions of these functions, where I think both the ldexp and scalbn functions already deal with setting errno. As a cleanup (not needed to fix this bug) however you might want to make those functions into aliases for IA64; there is no need for them to be separate function implementations at all. * This concludes the fix for bug 6803 since the scalb and scalbln cases of that bug were fixed some time ago. Tested for x86_64, x86, mips64 and powerpc. [BZ #6803] * math/s_ldexp.c (scalbn): Define as weak alias of __ldexp. [NO_LONG_DOUBLE] (scalbnl): Define as weak alias of __ldexp. * math/s_ldexpf.c (scalbnf): Define as weak alias of __ldexpf. * math/s_ldexpl.c (scalbnl): Define as weak alias of __ldexpl. * sysdeps/i386/fpu/s_scalbn.S (scalbn): Remove alias. * sysdeps/i386/fpu/s_scalbnf.S (scalbnf): Likewise. * sysdeps/i386/fpu/s_scalbnl.S (scalbnl): Likewise. * sysdeps/ieee754/dbl-64/s_scalbn.c (scalbn): Likewise. [NO_LONG_DOUBLE] (scalbnl): Likewise. * sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c (scalbn): Likewise. [NO_LONG_DOUBLE] (scalbnl): Likewise. * sysdeps/ieee754/flt-32/s_scalbnf.c (scalbnf): Likewise. * sysdeps/ieee754/ldbl-128/s_scalbnl.c (scalbnl): Likewise. * sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c (scalbnl): Remove long_double_symbol calls. * sysdeps/ieee754/ldbl-64-128/s_scalbnl.c (scalbnl): Likewise. * sysdeps/ieee754/ldbl-opt/s_ldexpl.c (__ldexpl_2): Define as strong alias of __ldexpl. (scalbnl): Define using long_double_symbol. * sysdeps/m68k/m680x0/fpu/s_scalbn.c (__CONCATX(scalbn,suffix)): Remove alias. * sysdeps/sparc/sparc64/soft-fp/s_scalbnl.c (scalbnl): Likewise. * sysdeps/x86_64/fpu/s_scalbnl.S (scalbnl): Likewise. * math/libm-test.inc (scalbn_test_data): Add errno expectations. (scalbln_test_data): Add more errno expectations.
* Update de.po from Translation Project (bug 4404).Joseph Myers2015-09-161-6/+7
| | | | | [BZ #4404] * po/de.po: Update from Translation Project.
* Clean up ldbl-128 / ldbl-128ibm expm1l dead code (bug 16415).Joseph Myers2015-09-161-6/+6
| | | | | | | | | | | | | | | | The ldbl-128 and ldbl-128ibm expm1l implementations have code to handle +Inf and finite arguments above an overflow threshold. Since they now use __expl for large positive arguments to fix other problems, this code is unreachable; this patch removes it. Tested for mips64 and powerpc. [BZ #16415] * sysdeps/ieee754/ldbl-128/s_expm1l.c (maxlog): Remove variable. (__expm1l): Remove code to handle positive infinity and overflow. * sysdeps/ieee754/ldbl-128ibm/s_expm1l.c (maxlog): Remove variable. (__expm1l): Remove code to handle positive infinity and overflow.
* Fix BZ #18872 -- memory leak in printf_positional.Paul Pluzhnikov2015-09-161-1/+1
|
* Remove extra va_start/va_end calls (bug 17244)Andreas Schwab2015-09-161-5/+5
|
* Add missing va_end calls (bug 17243)Andreas Schwab2015-09-161-5/+5
|
* Fix math.h, tgmath.h XSI POSIX namespace (gamma, isnan, scalb) (bug 18967).Joseph Myers2015-09-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | math.h incorrectly declares various functions for XSI POSIX 2001 and 2008 editions. gamma was removed in the 2001 edition but is still declared, along with gammaf and gammal which were never standard functions. isnan is still declared as a function, along with isnanf and isnanl which were never standard functions, although in 2001 the function was replaced by the type-generic macro. scalbf and scalbl are declared although never standard, and scalb was removed in the 2008 edition but is still declared. The scalb type-generic macro in tgmath.h shouldn't be present for any POSIX version, since POSIX never had such a type-generic macro. This patch disables all those declarations in the relevant cases (as a minimal fix, it leaves them enabled for __USE_MISC). For the matter of declaring scalb but not scalbf or scalbl for the 2001 edition, a new macro __MATH_DECLARING_DOUBLE is added, defined by math.h around includes of bits/mathcalls.h, for bits/mathcalls.h to use to test which type's functions are being declared. Tested for x86_64 and x86 (testsuite, and that installed stripped shared libraries are unchanged by the patch). [BZ #18967] * math/math.h (__MATH_DECLARING_DOUBLE): New macro. Define and undefine around includes of <bits/mathcalls.h>. * math/bits/mathcalls.h [!__USE_MISC && __USE_XOPEN2K] (isnan): Do not declare function. [!__USE_MISC && __USE_XOPEN2K] (gamma): Likewise. [!__USE_MISC && (!__MATH_DECLARING_DOUBLE || __USE_XOPEN2K8)] (scalb): Likewise. * math/tgmath.h [!__USE_MISC && __USE_XOPEN_EXTENDED] (scalb): Do not define macro. * conform/Makefile (test-xfail-XOPEN2K/math.h/conform): Remove variable. (test-xfail-XOPEN2K/tgmath.h/conform): Likewise. (test-xfail-XOPEN2K8/math.h/conform): Likewise. (test-xfail-XOPEN2K8/tgmath.h/conform): Likewise.
* Fix ldbl-128ibm nearbyintl use of signaling comparisons on NaNs (bug 18857).Joseph Myers2015-09-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | The ldbl-128ibm implementation of nearbyintl wrongly uses signaling comparisons such as "if (fabs (u.d[0].d) < TWO52)" on arguments that might be NaNs, when "invalid" exceptions should not be raised. (For hard float, this issue may be hidden by <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58684>, powerpc GCC wrongly only using unordered comparison instructions.) This patch fixes this by just returning the argument if it is not finite (because of the arbitrary value of the low part of a NaN in IBM long double, there are quite a lot of comparisons that could end up involving a NaN when the argument to nearbyintl is a NaN, so excluding NaN arguments at the start is the simplest and safest fix). Tested for powerpc-nofpu, where it removes failures for spurious "invalid" exceptions from nearbyintl. [BZ #18857] * sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c (__nearbyintl): Just return non-finite argument without doing ordered comparisons on it.
* Mark fegetround pure (bug 16296).Joseph Myers2015-09-151-6/+6
| | | | | | | | | | | | Bug 16296 notes that fegetround is a pure function and should be marked as such in fenv.h. This patch implements that. Tested for x86_64 and x86 (testsuite, and that installed stripped shared libraries are unchanged by this patch). [BZ #16296] * math/fenv.h (fegetround): Use __attribute_pure__. * include/fenv.h (__fegetround): Likewise.
* Fix ctan, ctanh missing underflows (bug 18595).Joseph Myers2015-09-151-4/+4
| | | | | | | | | | | | | | | | | | | | Similar to various other bugs in this area, ctan and ctanh can fail to raise the underflow exception for some cases of results that are tiny and inexact. This patch forces the exception in a similar way to previous fixes. Tested for x86_64 and x86. [BZ #18595] * math/s_ctan.c (__ctan): Force underflow exception for results whose real or imaginary part has small absolute value. * math/s_ctanf.c (__ctanf): Likewise. * math/s_ctanh.c (__ctanh): Likewise. * math/s_ctanhf.c (__ctanhf): Likewise. * math/s_ctanhl.c (__ctanhl): Likewise. * math/s_ctanl.c (__ctanl): Likewise. * math/auto-libm-test-in: Do not allow missing underflow for ctan and ctanh. Add more tests of ctan and ctanh.
* Simplify hypotf infinity handling (bug 15918).Joseph Myers2015-09-151-6/+6
| | | | | | | | | | | | | | Bug 15918 points out that the handling of infinities in hypotf can be simplified: it's enough to return the absolute value of the infinite argument without first comparing it to the other argument and possibly returning that other argument's absolute value. This patch makes that cleanup (which should not change how hypotf behaves on any input). Tested for x86_64. [BZ #15918] * sysdeps/ieee754/flt-32/e_hypotf.c (__ieee754_hypotf): Simplify handling of cases where one argument is an infinity.
* Fix i386 exp10 missing underflows (bug 18966).Joseph Myers2015-09-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | On i386, the double version of exp10 can miss underflow exceptions if the result is in the subnormal range for double but the last 11 bits of the 64-bit extended-precision mantissa happen to be zero. This patch forces the exception in a similar way to previous fixes. As with the exp2 and exp fixes, the exp10f changes may in fact not be needed to ensure underflow exceptions, but are included for consistency and to fix the exp10 part of bug 18875 by ensuring that excess range and precision is removed from underflowing return values. Tested for x86_64 and x86. [BZ #18875] [BZ #18966] * sysdeps/i386/fpu/e_exp10.S (dbl_min): New object. (MO): New macro. (__ieee754_exp10): For small results, force underflow exception and remove excess range and precision from return value. * sysdeps/i386/fpu/e_exp10f.S (flt_min): New object. (MO): New macro. (__ieee754_exp10f): For small results, force underflow exception and remove excess range and precision from return value. * math/auto-libm-test-in: Add more tests of exp10. * math/auto-libm-test-out: Regenerated.
* Fix i386 exp missing underflows (bug 18961).Joseph Myers2015-09-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | On i386, the double version of exp can miss underflow exceptions if the result is in the subnormal range for double but the last 11 bits of the 64-bit extended-precision mantissa happen to be zero. This patch forces the exception in a similar way to previous fixes. As with the exp2 fixes, the expf changes may in fact not be needed to ensure underflow exceptions, but are included for consistency and to fix the exp part of bug 18875 by ensuring that excess range and precision is removed from underflowing return values. Tested for x86_64 and x86. [BZ #18875] [BZ #18961] * sysdeps/i386/fpu/e_exp.S (dbl_min): New object. (MO): New macro. (__ieee754_exp): For small results, force underflow exception and remove excess range and precision from return value. (__exp_finite): Likewise. * sysdeps/i386/fpu/e_expf.S (flt_min): New object. (MO): New macro. (__ieee754_expf): For small results, force underflow exception and remove excess range and precision from return value. (__expf_finite): Likewise. * math/auto-libm-test-in: Add more tests of exp. * math/auto-libm-test-out: Regenerated.
* Fix exp2 missing underflows (bug 16521).Joseph Myers2015-09-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Various exp2 implementations in glibc can miss underflow exceptions when the scaling down part of the calculation is exact (or, in the x86 case, when the conversion from extended precision to the target precision is exact). This patch forces the exception in a similar way to previous fixes. The x86 exp2f changes may in fact not be needed for this purpose - it's likely to be the case that no argument of type float has an exp2 result so close to an exact subnormal float value that it equals that value when rounded to 64 bits (even taking account of variation between different x86 implementations). However, they are included for consistency with the changes to exp2 and so as to fix the exp2f part of bug 18875 by ensuring that excess range and precision is removed from underflowing return values. Tested for x86_64, x86 and mips64. [BZ #16521] [BZ #18875] * math/e_exp2l.c (__ieee754_exp2l): Force underflow exception for small results. * sysdeps/i386/fpu/e_exp2.S (dbl_min): New object. (MO): New macro. (__ieee754_exp2): For small results, force underflow exception and remove excess range and precision from return value. * sysdeps/i386/fpu/e_exp2f.S (flt_min): New object. (MO): New macro. (__ieee754_exp2f): For small results, force underflow exception and remove excess range and precision from return value. * sysdeps/i386/fpu/e_exp2l.S (ldbl_min): New object. (MO): New macro. (__ieee754_exp2l): Force underflow exception for small results. * sysdeps/ieee754/dbl-64/e_exp2.c (__ieee754_exp2): Likewise. * sysdeps/ieee754/flt-32/e_exp2f.c (__ieee754_exp2f): Likewise. * sysdeps/x86_64/fpu/e_exp2l.S (ldbl_min): New object. (MO): New macro. (__ieee754_exp2l): Force underflow exception for small results. * math/auto-libm-test-in: Add more tests or exp2. * math/auto-libm-test-out: Regenerated.
* localedef: improve error message [BZ #16985]Mike Frysinger2015-09-111-4/+4
| | | | | | | | If you pass in a path that fails to be opened, then output_path is set to NULL, and an error is flagged. Then at the end, we use both of those: cannot write output files to `(null)': No such file or directory Tweak the message to use the user's input when output_path is NULL.
* Move bits/atomic.h to atomic-machine.h (bug 14912).Joseph Myers2015-09-111-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was noted in <https://sourceware.org/ml/libc-alpha/2012-09/msg00305.html> that the bits/*.h naming scheme should only be used for installed headers. This patch renames bits/atomic.h to atomic-machine.h to follow that convention. This is the only change in this series that needs to change the filename rather than simply removing a directory level (because both atomic.h and bits/atomic.h exist at present). Tested for x86_64 (testsuite, and that installed stripped shared libraries are unchanged by the patch). [BZ #14912] * sysdeps/aarch64/bits/atomic.h: Move to ... * sysdeps/aarch64/atomic-machine.h: ...here. (_AARCH64_BITS_ATOMIC_H): Rename macro to _AARCH64_ATOMIC_MACHINE_H. * sysdeps/alpha/bits/atomic.h: Move to ... * sysdeps/alpha/atomic-machine.h: ...here. * sysdeps/arm/bits/atomic.h: Move to ... * sysdeps/arm/atomic-machine.h: ...here. Update comments. * bits/atomic.h: Move to ... * sysdeps/generic/atomic-machine.h: ...here. (_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H. * sysdeps/i386/bits/atomic.h: Move to ... * sysdeps/i386/atomic-machine.h: ...here. * sysdeps/ia64/bits/atomic.h: Move to ... * sysdeps/ia64/atomic-machine.h: ...here. * sysdeps/m68k/coldfire/bits/atomic.h: Move to ... * sysdeps/m68k/coldfire/atomic-machine.h: ...here. (_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H. * sysdeps/m68k/m680x0/m68020/bits/atomic.h: Move to ... * sysdeps/m68k/m680x0/m68020/atomic-machine.h: ...here. * sysdeps/microblaze/bits/atomic.h: Move to ... * sysdeps/microblaze/atomic-machine.h: ...here. * sysdeps/mips/bits/atomic.h: Move to ... * sysdeps/mips/atomic-machine.h: ...here. (_MIPS_BITS_ATOMIC_H): Rename macro to _MIPS_ATOMIC_MACHINE_H. * sysdeps/powerpc/bits/atomic.h: Move to ... * sysdeps/powerpc/atomic-machine.h: ...here. Update comments. * sysdeps/powerpc/powerpc32/bits/atomic.h: Move to ... * sysdeps/powerpc/powerpc32/atomic-machine.h: ...here. Update comments. Include <atomic-machine.h> instead of <bits/atomic.h>. * sysdeps/powerpc/powerpc64/bits/atomic.h: Move to ... * sysdeps/powerpc/powerpc64/atomic-machine.h: ...here. Include <atomic-machine.h> instead of <bits/atomic.h>. * sysdeps/s390/bits/atomic.h: Move to ... * sysdeps/s390/atomic-machine.h: ...here. * sysdeps/sparc/sparc32/bits/atomic.h: Move to ... * sysdeps/sparc/sparc32/atomic-machine.h: ...here. (_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H. * sysdeps/sparc/sparc32/sparcv9/bits/atomic.h: Move to ... * sysdeps/sparc/sparc32/sparcv9/atomic-machine.h: ...here. * sysdeps/sparc/sparc64/bits/atomic.h: Move to ... * sysdeps/sparc/sparc64/atomic-machine.h: ...here. * sysdeps/tile/bits/atomic.h: Move to ... * sysdeps/tile/atomic-machine.h: ...here. * sysdeps/tile/tilegx/bits/atomic.h: Move to ... * sysdeps/tile/tilegx/atomic-machine.h: ...here. Include <sysdeps/tile/atomic-machine.h> instead of <sysdeps/tile/bits/atomic.h>. (_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H. * sysdeps/tile/tilepro/bits/atomic.h: Move to ... * sysdeps/tile/tilepro/atomic-machine.h: ...here. Include <sysdeps/tile/atomic-machine.h> instead of <sysdeps/tile/bits/atomic.h>. (_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H. * sysdeps/unix/sysv/linux/arm/bits/atomic.h: Move to ... * sysdeps/unix/sysv/linux/arm/atomic-machine.h: ...here. Include <sysdeps/arm/atomic-machine.h> instead of <sysdeps/arm/bits/atomic.h>. * sysdeps/unix/sysv/linux/hppa/bits/atomic.h: Move to ... * sysdeps/unix/sysv/linux/hppa/atomic-machine.h: ...here. (_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H. * sysdeps/unix/sysv/linux/m68k/coldfire/bits/atomic.h: Move to ... * sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h: ...here. (_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H. * sysdeps/unix/sysv/linux/nios2/bits/atomic.h: Move to ... * sysdeps/unix/sysv/linux/nios2/atomic-machine.h: ...here. (_NIOS2_BITS_ATOMIC_H): Rename macro to _NIOS2_ATOMIC_MACHINE_H. * sysdeps/unix/sysv/linux/sh/bits/atomic.h: Move to ... * sysdeps/unix/sysv/linux/sh/atomic-machine.h: ...here. * sysdeps/x86_64/bits/atomic.h: Move to ... * sysdeps/x86_64/atomic-machine.h: ...here. * include/atomic.h: Include <atomic-machine.h> instead of <bits/atomic.h>.
* Fix ldbl-128/ldbl-128ibm lgamma spurious "invalid", incorrect signgam (bug ↵Joseph Myers2015-09-111-1/+1
| | | | | | | | | | | | | | | | | | | | 18952). The ldbl-128 / ldbl-128ibm implementation of lgammal converts (the floor of minus) non-integer negative arguments to int to determine the value of signgam. When those values are outside the range of int, this produces spurious "invalid" exceptions and incorrect values of signgam. This patch fixes this by instead determining signgam through comparing half the integer in question to floor of half the integer. Tested for mips64, x86_64 and x86. [BZ #18952] * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (__ieee754_lgammal_r): Do not convert non-integer negative arguments to int to determine the value of signgam. * math/auto-libm-test-in: Add more tests of lgamma. * math/auto-libm-test-out: Regenerated.
* Fix lgamma (negative) inaccuracy (bug 2542, bug 2543, bug 2558).Joseph Myers2015-09-101-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing implementations of lgamma functions (except for the ia64 versions) use the reflection formula for negative arguments. This suffers large inaccuracy from cancellation near zeros of lgamma (near where the gamma function is +/- 1). This patch fixes this inaccuracy. For arguments above -2, there are no zeros and no large cancellation, while for sufficiently large negative arguments the zeros are so close to integers that even for integers +/- 1ulp the log(gamma(1-x)) term dominates and cancellation is not significant. Thus, it is only necessary to take special care about cancellation for arguments around a limited number of zeros. Accordingly, this patch uses precomputed tables of relevant zeros, expressed as the sum of two floating-point values. The log of the ratio of two sines can be computed accurately using log1p in cases where log would lose accuracy. The log of the ratio of two gamma(1-x) values can be computed using Stirling's approximation (the difference between two values of that approximation to lgamma being computable without computing the two values and then subtracting), with appropriate adjustments (which don't reduce accuracy too much) in cases where 1-x is too small to use Stirling's approximation directly. In the interval from -3 to -2, using the ratios of sines and of gamma(1-x) can still produce too much cancellation between those two parts of the computation (and that interval is also the worst interval for computing the ratio between gamma(1-x) values, which computation becomes more accurate, while being less critical for the final result, for larger 1-x). Because this can result in errors slightly above those accepted in glibc, this interval is instead dealt with by polynomial approximations. Separate polynomial approximations to (|gamma(x)|-1)(x-n)/(x-x0) are used for each interval of length 1/8 from -3 to -2, where n (-3 or -2) is the nearest integer to the 1/8-interval and x0 is the zero of lgamma in the relevant half-integer interval (-3 to -2.5 or -2.5 to -2). Together, the two approaches are intended to give sufficient accuracy for all negative arguments in the problem range. Outside that range, the previous implementation continues to be used. Tested for x86_64, x86, mips64 and powerpc. The mips64 and powerpc testing shows up pre-existing problems for ldbl-128 and ldbl-128ibm with large negative arguments giving spurious "invalid" exceptions (exposed by newly added tests for cases this patch doesn't affect the logic for); I'll address those problems separately. [BZ #2542] [BZ #2543] [BZ #2558] * sysdeps/ieee754/dbl-64/e_lgamma_r.c (__ieee754_lgamma_r): Call __lgamma_neg for arguments from -28.0 to -2.0. * sysdeps/ieee754/flt-32/e_lgammaf_r.c (__ieee754_lgammaf_r): Call __lgamma_negf for arguments from -15.0 to -2.0. * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (__ieee754_lgammal_r): Call __lgamma_negl for arguments from -48.0 or -50.0 to -2.0. * sysdeps/ieee754/ldbl-96/e_lgammal_r.c (__ieee754_lgammal_r): Call __lgamma_negl for arguments from -33.0 to -2.0. * sysdeps/ieee754/dbl-64/lgamma_neg.c: New file. * sysdeps/ieee754/dbl-64/lgamma_product.c: Likewise. * sysdeps/ieee754/flt-32/lgamma_negf.c: Likewise. * sysdeps/ieee754/flt-32/lgamma_productf.c: Likewise. * sysdeps/ieee754/ldbl-128/lgamma_negl.c: Likewise. * sysdeps/ieee754/ldbl-128/lgamma_productl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/lgamma_negl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/lgamma_productl.c: Likewise. * sysdeps/ieee754/ldbl-96/lgamma_negl.c: Likewise. * sysdeps/ieee754/ldbl-96/lgamma_product.c: Likewise. * sysdeps/ieee754/ldbl-96/lgamma_productl.c: Likewise. * sysdeps/generic/math_private.h (__lgamma_negf): New prototype. (__lgamma_neg): Likewise. (__lgamma_negl): Likewise. (__lgamma_product): Likewise. (__lgamma_productl): Likewise. * math/Makefile (libm-calls): Add lgamma_neg and lgamma_product. * math/auto-libm-test-in: Add more tests of lgamma. * math/auto-libm-test-out: Regenerated. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* To fix BZ #18675, use __fstatvfs64 in __fpathconf.Paul Pluzhnikov2015-09-091-3/+3
|
* BZ#18921: Mark fixed in NEWS.Roland McGrath2015-09-081-2/+2
|
* Fix BZ #18757.Paul Pluzhnikov2015-09-011-2/+3
|