Bug 18875

Summary: Excess precision leads incorrect libm
Product: glibc Reporter: H.J. Lu <hjl.tools>
Component: mathAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal Flags: fweimer: security-
Priority: P2    
Version: 2.23   
Target Milestone: 2.23   
Host: Target: x86
Build: Last reconfirmed:

Description H.J. Lu 2015-08-26 12:50:42 UTC
sysdeps/ieee754/flt-32/w_expf.c has

  if (__builtin_expect (!isfinite (z) || z == 0, 0)

On x86 with excess precision, we got

(gdb) info float
=>R7: Valid   0x3d30e0d9b4d78a806800 +6.369668676344082156e-217 
  R6: Empty   0x40029000000000000000

and z (+6.369668676344082156e-217) == 0 became false.  This
leads to

Failure: exp (-0x1.f1cf36p+8): errno set to 0, expected 34 (ERANGE)
Failure: exp_downward (-0x1.f1cf36p+8): errno set to 0, expected 34 (ERANGE)
Failure: exp_towardzero (-0x1.f1cf36p+8): errno set to 0, expected 34 (ERANGE)

in math/test-float.out.  This may also be the cause for

Failure: exp10 (-0x1.31p+8): errno set to 0, expected 34 (ERANGE)
Failure: exp10 (-0x1.343792p+12): errno set to 0, expected 34 (ERANGE)
Failure: exp10 (-0x1.343794p+12): errno set to 0, expected 34 (ERANGE)
Failure: exp10 (-0x1.344p+12): errno set to 0, expected 34 (ERANGE)
Failure: exp10_downward (-0x1.31p+8): errno set to 0, expected 34 (ERANGE)
Failure: exp10_downward (-0x1.343792p+12): errno set to 0, expected 34 (ERANGE)
Failure: exp10_downward (-0x1.343794p+12): errno set to 0, expected 34 (ERANGE)
Failure: exp10_downward (-0x1.344p+12): errno set to 0, expected 34 (ERANGE)
Failure: exp10_towardzero (-0x1.31p+8): errno set to 0, expected 34 (ERANGE)
Failure: exp10_towardzero (-0x1.343792p+12): errno set to 0, expected 34 (ERANGE)
Failure: exp10_towardzero (-0x1.343794p+12): errno set to 0, expected 34 (ERANGE)
Failure: exp10_towardzero (-0x1.344p+12): errno set to 0, expected 34 (ERANGE)
Failure: exp2 (-0x1.3045fep+8): errno set to 0, expected 34 (ERANGE)
Failure: exp2 (-0x3.fb8p+8): errno set to 0, expected 34 (ERANGE)
Failure: exp2 (-0x3.fc8p+8): errno set to 0, expected 34 (ERANGE)
Failure: exp2 (-0x3.fd8p+8): errno set to 0, expected 34 (ERANGE)
Failure: exp2 (-0x4.01p+12): errno set to 0, expected 34 (ERANGE)
Failure: exp2 (-0x4.32p+8): errno set to 0, expected 34 (ERANGE)
Failure: exp2_downward (-0x1.3045fep+8): errno set to 0, expected 34 (ERANGE)
Failure: exp2_downward (-0x3.fb8p+8): errno set to 0, expected 34 (ERANGE)
Failure: exp2_downward (-0x3.fc8p+8): errno set to 0, expected 34 (ERANGE)
Failure: exp2_downward (-0x3.fd8p+8): errno set to 0, expected 34 (ERANGE)
Failure: exp2_downward (-0x4.01p+12): errno set to 0, expected 34 (ERANGE)
Failure: exp2_downward (-0x4.32p+8): errno set to 0, expected 34 (ERANGE)
Failure: exp2_towardzero (-0x1.3045fep+8): errno set to 0, expected 34 (ERANGE)
Failure: exp2_towardzero (-0x3.fb8p+8): errno set to 0, expected 34 (ERANGE)
Failure: exp2_towardzero (-0x3.fc8p+8): errno set to 0, expected 34 (ERANGE)
Failure: exp2_towardzero (-0x3.fd8p+8): errno set to 0, expected 34 (ERANGE)
Failure: exp2_towardzero (-0x4.01p+12): errno set to 0, expected 34 (ERANGE)
Failure: exp2_towardzero (-0x4.32p+8): errno set to 0, expected 34 (ERANGE)
Failure: pow10 (-0x1.31p+8): errno set to 0, expected 34 (ERANGE)
Failure: pow10 (-0x1.343792p+12): errno set to 0, expected 34 (ERANGE)
Failure: pow10 (-0x1.343794p+12): errno set to 0, expected 34 (ERANGE)
Failure: pow10 (-0x1.344p+12): errno set to 0, expected 34 (ERANGE)
Failure: pow10_downward (-0x1.31p+8): errno set to 0, expected 34 (ERANGE)
Failure: pow10_downward (-0x1.343792p+12): errno set to 0, expected 34 (ERANGE)
Failure: pow10_downward (-0x1.343794p+12): errno set to 0, expected 34 (ERANGE)
Failure: pow10_downward (-0x1.344p+12): errno set to 0, expected 34 (ERANGE)
Failure: pow10_towardzero (-0x1.31p+8): errno set to 0, expected 34 (ERANGE)
Failure: pow10_towardzero (-0x1.343792p+12): errno set to 0, expected 34 (ERANGE)
Failure: pow10_towardzero (-0x1.343794p+12): errno set to 0, expected 34 (ERANGE)
Failure: pow10_towardzero (-0x1.344p+12): errno set to 0, expected 34 (ERANGE)

in math/test-float.out on i686.
Comment 1 joseph@codesourcery.com 2015-08-26 13:15:12 UTC
That would be the issue Carlos has twice reported.

https://sourceware.org/ml/libc-alpha/2015-01/msg00484.html
https://sourceware.org/ml/libc-alpha/2015-01/msg00485.html
https://sourceware.org/ml/libc-alpha/2015-07/msg00212.html

Fixing it shouldn't be hard - just store to and load back from the stack 
(remembering CFI adjustments) before return, at least when the result is 
below FLT_MIN (DBL_MIN for the double functions - the issue could 
presumably appear for those as well depending on the compiler version).  
I've just never seen this issue with the compilers I've been testing with, 
so am not in a good position to prepare and test a fix.

E.g. atan2 already does this, together with (in the case of small results) 
storing to the stack the result of multiplying the small result by itself 
to avoid missing underflow exceptions if the extended precision result 
rounds exactly to float / double but in fact isn't exact.  The same issue 
of avoiding such missing underflows also applies to these functions, so 
you could always copy all the code from atan2f / atan2 that compares with 
FLT_MIN / DBL_MIN and handles these issues if so (minus the fabs 
instructions since the functions in question here never have negative 
results).
Comment 2 cvs-commit@gcc.gnu.org 2015-08-26 13:34:49 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, hjl/i486/multiarch has been created
        at  f7eea8a23ba1eac64fb4df4adac0994eb1100bbb (commit)

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f7eea8a23ba1eac64fb4df4adac0994eb1100bbb

commit f7eea8a23ba1eac64fb4df4adac0994eb1100bbb
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Aug 26 04:20:42 2015 -0700

    Add i386 math multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6382df1128284235df4b74eca24b74a55cb0b067

commit 6382df1128284235df4b74eca24b74a55cb0b067
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Aug 25 07:45:24 2015 -0700

    Add i386 wmemcmp multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=37e0039145eab31a6f40bd4f405d70980a10997e

commit 37e0039145eab31a6f40bd4f405d70980a10997e
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Aug 25 06:51:45 2015 -0700

    Add i386 wcslen multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0c214795731114419952cdee950126f511d78256

commit 0c214795731114419952cdee950126f511d78256
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Aug 25 06:24:16 2015 -0700

    Add i386 wcscpy multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8b5e495be44cd9784204b3b17b059424b55c192d

commit 8b5e495be44cd9784204b3b17b059424b55c192d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Aug 25 06:12:47 2015 -0700

    Add i386 wcscmp multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4dc3f36ad92e8483f64a2ee832ee689c2359b925

commit 4dc3f36ad92e8483f64a2ee832ee689c2359b925
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Aug 25 06:06:30 2015 -0700

    Add i386 wcschr/wcsrchr multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c30b6b2c95b116f7088f7d254c8bb1c3c2f0b357

commit c30b6b2c95b116f7088f7d254c8bb1c3c2f0b357
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Aug 24 16:03:28 2015 -0700

    Add i386 strspn multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=bab8c4eff77fe6d1f15a6cb36bf66a950ffcbed8

commit bab8c4eff77fe6d1f15a6cb36bf66a950ffcbed8
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Aug 24 13:01:12 2015 -0700

    Add i386 strlen family multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=7242ead89619cef1105c879cfe08c9cd61794d79

commit 7242ead89619cef1105c879cfe08c9cd61794d79
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Aug 24 11:41:57 2015 -0700

    Add i386 strrchr multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=79d496f795977272c898b3361e4f924eda944380

commit 79d496f795977272c898b3361e4f924eda944380
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Aug 24 10:46:29 2015 -0700

    Add i386 strcspn family multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=dac0c89a3d69a11ccdc5ccf0212f6ed687ba5071

commit dac0c89a3d69a11ccdc5ccf0212f6ed687ba5071
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Aug 23 12:47:24 2015 -0700

    Add i386 strchr multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=755b04a7a8927ff6a7e67a4e05f764da2741f2ee

commit 755b04a7a8927ff6a7e67a4e05f764da2741f2ee
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 15:20:58 2015 -0700

    Add i386 strcat multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e97d33ad32153aec16fdeae573ff003d76522a8f

commit e97d33ad32153aec16fdeae573ff003d76522a8f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 13:57:22 2015 -0700

    Add i386 strcmp family multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=91c716e2d9ccf9423a5061a9cf71a4572159bb6e

commit 91c716e2d9ccf9423a5061a9cf71a4572159bb6e
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 12:05:50 2015 -0700

    Add i386 strcpy family multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=7861c599d99f5cff9cceb0fbc9123a94090b0555

commit 7861c599d99f5cff9cceb0fbc9123a94090b0555
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 08:56:52 2015 -0700

    Add i386 s_fma family multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=02ff40bab5a671b590bdf21c9219b863f2d52f4b

commit 02ff40bab5a671b590bdf21c9219b863f2d52f4b
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 08:39:14 2015 -0700

    Add i386 sched_cpucount multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=fec5d43d6ed8734d23ee353ecbc8e0ebb708398d

commit fec5d43d6ed8734d23ee353ecbc8e0ebb708398d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 08:33:40 2015 -0700

    Add i386 rawmemchr multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4fe752c906aaf1d1d8e956f4a0d3eb89dcc92c99

commit 4fe752c906aaf1d1d8e956f4a0d3eb89dcc92c99
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 08:28:10 2015 -0700

    Add i386 memrchr multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=db05d09576d5df9c99915fe606c23ff3ed48764a

commit db05d09576d5df9c99915fe606c23ff3ed48764a
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 08:20:41 2015 -0700

    Add i386 memcmp multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=509b30facb29ec41a303afcfefbe767214c50209

commit 509b30facb29ec41a303afcfefbe767214c50209
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 08:05:39 2015 -0700

    Add i386 memchr multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d1d165f3d9b3c516d36d346c55004ada0b325ff4

commit d1d165f3d9b3c516d36d346c55004ada0b325ff4
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 06:28:49 2015 -0700

    Add i386 memcpy family multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=eac66bd967d2799596af357f7e4210c56ad8e9a4

commit eac66bd967d2799596af357f7e4210c56ad8e9a4
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Aug 19 14:10:40 2015 -0700

    Add i386 memset family multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b6a42295f437e7c3ab942d915d616bc1d8367b5d

commit b6a42295f437e7c3ab942d915d616bc1d8367b5d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Aug 18 13:45:25 2015 -0700

    Add i386 memset and memcpy assembly functions
    
    Add i386 memset and memcpy assembly functions with REP MOVSB/STOSB
    instructions.
    
    	* sysdeps/i386/bcopy.S: New file.
    	* sysdeps/i386/bzero.S: Likewise.
    	* sysdeps/i386/memcpy.S: Likewise.
    	* sysdeps/i386/memmove.S: Likewise.
    	* sysdeps/i386/mempcpy.S: Likewise.
    	* sysdeps/i386/memset.S: Likewise.
    	* sysdeps/i386/bzero.c: Removed.
    	* sysdeps/i386/memset.c: Likewise.
    	* sysdeps/i386/i586/memcpy_chk.S: Likewise.
    	* sysdeps/i386/i586/mempcpy_chk.S: Likewise.
    	* sysdeps/i386/i586/memset_chk.S: Likewise.
    	* sysdeps/i386/i686/memcpy_chk.S: Moved to ...
    	* sysdeps/i386/memcpy_chk.S: Here.
    	* sysdeps/i386/i686/memmove_chk.S: Moved to ...
    	* sysdeps/i386/memmove_chk.S: Here.
    	* sysdeps/i386/i686/mempcpy_chk.S: Moved to ...
    	* sysdeps/i386/mempcpy_chk.S: Likewise.
    	* sysdeps/i386/i686/memset_chk.S: Moved to ...
    	* sysdeps/i386/memset_chk.S: Likewise.

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b6486a4bc96371871e74ac92bc0c83ef6a70f3f1

commit b6486a4bc96371871e74ac92bc0c83ef6a70f3f1
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Aug 17 10:19:05 2015 -0700

    Detect i586 and i686 features at run-time
    
    We detect i586 and i686 features at run-time by checking CX8 and CMOV
    CPUID features bits.  We can use these information to select the best
    implementation in ix86 multiarch.  Due to the reordering and the other
    nifty extensions in i686, it is not really good to use heavily i586
    optimized code on an i686.  It's better to use i486/i386 code if it
    isn't an i586.
    
    	* sysdeps/i386/init-arch.h: New file.
    	* sysdeps/i386/i486/init-arch.h: Likewise.
    	* sysdeps/i386/i586/init-arch.h: Likewise.
    	* sysdeps/i386/i686/init-arch.h: Likewise.
    	* sysdeps/x86/cpu-features.c (init_cpu_features): Set bit_I586
    	bit if CX8 is available.  Set bit_I686 bit if CMOV is available.
    	* sysdeps/x86/cpu-features.h (bit_I586): New.
    	(bit_I686): Likewise.
    	(bit_CX8): Likewise.
    	(bit_CMOV): Likewise.
    	(index_CX8): Likewise.
    	(index_CMOV): Likewise.
    	(index_I586): Likewise.
    	(index_I686): Likewise.
    	(reg_CX8): Likewise.
    	(reg_CMOV): Likewise.
    	(HAS_I586): Defined as HAS_ARCH_FEATURE (I586) if i586 isn't
    	available at compile-time.
    	(HAS_I686): Defined as HAS_ARCH_FEATURE (I686) if i686 isn't
    	available at compile-time.
    	* sysdeps/x86/init-arch.h (USE_I586): New macro.
    	(USE_I686): Likewise.

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=81100cea4a76c82babbeda9c414ef3f47f48b967

commit 81100cea4a76c82babbeda9c414ef3f47f48b967
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 09:50:33 2015 -0700

    Replace MEMPCPY_P/PIC with USE_AS_MEMPCPY/SHARED
    
    Replace MEMPCPY_P with USE_AS_MEMPCPY in i586 memcpy.S to support i386
    multi-arch memcpy.  Also we should check SHARED not PIC for libc.so
    since libc.a may be compiled with PIC.
    
    	* sysdeps/i386/i586/memcpy.S (MEMPCPY_P): Removed.
    	Check USE_AS_MEMPCPY/SHARED instead of MEMPCPY_P/PIC.
    	* sysdeps/i386/i586/mempcpy.S (USE_AS_MEMPCPY): New.

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a57dad3d7c1fc9c1b795c83dedc3809918c4bddc

commit a57dad3d7c1fc9c1b795c83dedc3809918c4bddc
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Aug 19 13:43:30 2015 -0700

    Replace BZERO_P/PIC with USE_AS_BZERO/SHARED
    
    Replace BZERO_P with USE_AS_BZERO in i586/i686 memset.S to support i386
    multi-arch memset.  Also we should check SHARED not PIC for libc.so
    since libc.a may be compiled with PIC.
    
    	* sysdeps/i386/i586/bzero.S (USE_AS_BZERO): New.
    	* sysdeps/i386/i686/bzero.S (USE_AS_BZERO): Likewise.
    	* sysdeps/i386/i586/memset.S (BZERO_P): Removed.
    	Check USE_AS_BZERO/SHARED instead of BZERO_P/PIC.
    	(__memset_zero_constant_len_parameter): New.
    	* sysdeps/i386/i686/memset.S (BZERO_P): Removed.
    	Check USE_AS_BZERO/SHARED instead of BZERO_P/PIC.
    	(__memset_zero_constant_len_parameter): Don't define if
    	__memset_chk or USE_AS_BZERO are defined.

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=346823cdad1a889ce642d58e0ab3e11fcea0e824

commit 346823cdad1a889ce642d58e0ab3e11fcea0e824
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Aug 26 06:27:32 2015 -0700

    Avoid excess precision in check against float zero
    
    For check against float zero:
    
      float z;
      z = ...
      if (z == 0)
    
    on x86 with excess precision, we may get
    
    (gdb) info float
    =>R7: Valid   0x3d30e0d9b4d78a806800 +6.369668676344082156e-217
      R6: Empty   0x40029000000000000000
    
    and z (+6.369668676344082156e-217) == 0 is false.  We can avoid excess
    precision by checking binary representations of float zero directly.
    
    	[BZ #18875]
    	* sysdeps/i386/fpu/w_exp10f.c: New file.
    	* sysdeps/i386/fpu/w_exp2f.c: Likwise.
    	* sysdeps/i386/fpu/w_expf.c: Likwise.

-----------------------------------------------------------------------
Comment 3 cvs-commit@gcc.gnu.org 2015-08-26 13:42:39 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, hjl/i486/multiarch has been created
        at  5a3bf29118b420d8eaea8b98e56a8c80d137b6fc (commit)

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5a3bf29118b420d8eaea8b98e56a8c80d137b6fc

commit 5a3bf29118b420d8eaea8b98e56a8c80d137b6fc
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Aug 26 04:20:42 2015 -0700

    Add i386 math multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5ebb4c7501c7589e02bacae2b7e8111b4145b643

commit 5ebb4c7501c7589e02bacae2b7e8111b4145b643
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Aug 25 07:45:24 2015 -0700

    Add i386 wmemcmp multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3d9c3216a4420df83673beb9961fb15ec1ab65e0

commit 3d9c3216a4420df83673beb9961fb15ec1ab65e0
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Aug 25 06:51:45 2015 -0700

    Add i386 wcslen multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=dc5c8ff25c55f5e33cea1ed62ac8eb90cff676a0

commit dc5c8ff25c55f5e33cea1ed62ac8eb90cff676a0
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Aug 25 06:24:16 2015 -0700

    Add i386 wcscpy multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=cf68fa47a58d4a179ca233aea6f34b123151a3bc

commit cf68fa47a58d4a179ca233aea6f34b123151a3bc
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Aug 25 06:12:47 2015 -0700

    Add i386 wcscmp multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d32799c39a2133620ecde5050c141f28887066c6

commit d32799c39a2133620ecde5050c141f28887066c6
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Aug 25 06:06:30 2015 -0700

    Add i386 wcschr/wcsrchr multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=45d2a8f3ba836e030f33be116b4c64bde7fde636

commit 45d2a8f3ba836e030f33be116b4c64bde7fde636
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Aug 24 16:03:28 2015 -0700

    Add i386 strspn multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=626c25bf10334f20f3932bad5b48061972d4f8f1

commit 626c25bf10334f20f3932bad5b48061972d4f8f1
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Aug 24 13:01:12 2015 -0700

    Add i386 strlen family multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=784eafd46458efa4c7ef9b9e7179ae8fdc3039a6

commit 784eafd46458efa4c7ef9b9e7179ae8fdc3039a6
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Aug 24 11:41:57 2015 -0700

    Add i386 strrchr multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=1e8ba2ee47ca4dadd08634007702ef50f1846b00

commit 1e8ba2ee47ca4dadd08634007702ef50f1846b00
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Aug 24 10:46:29 2015 -0700

    Add i386 strcspn family multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9e696a41bf22c18f8159884bc65f3da43caa7edb

commit 9e696a41bf22c18f8159884bc65f3da43caa7edb
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Aug 23 12:47:24 2015 -0700

    Add i386 strchr multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=10154480674f2331e93a56d859de027f5f457164

commit 10154480674f2331e93a56d859de027f5f457164
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 15:20:58 2015 -0700

    Add i386 strcat multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f6e73f16131d3321fbf7a1fe18c81f91ae63f591

commit f6e73f16131d3321fbf7a1fe18c81f91ae63f591
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 13:57:22 2015 -0700

    Add i386 strcmp family multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2f2cd11515ecb078a799fbc921df2503f04d2140

commit 2f2cd11515ecb078a799fbc921df2503f04d2140
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 12:05:50 2015 -0700

    Add i386 strcpy family multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8ff7a3fbbfaaf7b408d2c07914ffeb287c73f208

commit 8ff7a3fbbfaaf7b408d2c07914ffeb287c73f208
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 08:56:52 2015 -0700

    Add i386 s_fma family multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=38699fca0b617981b9270449532a1b929613aa63

commit 38699fca0b617981b9270449532a1b929613aa63
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 08:39:14 2015 -0700

    Add i386 sched_cpucount multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b832be877bc1e4d3f679670aa7b328cdcad591e0

commit b832be877bc1e4d3f679670aa7b328cdcad591e0
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 08:33:40 2015 -0700

    Add i386 rawmemchr multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ef0677c8d8bc96f851f5b69a329d6feeda48b950

commit ef0677c8d8bc96f851f5b69a329d6feeda48b950
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 08:28:10 2015 -0700

    Add i386 memrchr multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=52cb8377590f501769e30ca18aab752750771d41

commit 52cb8377590f501769e30ca18aab752750771d41
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 08:20:41 2015 -0700

    Add i386 memcmp multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f91a1fbd13567733e00ffe0d8c7b29272176e451

commit f91a1fbd13567733e00ffe0d8c7b29272176e451
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 08:05:39 2015 -0700

    Add i386 memchr multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c4a46d734d55fa04265506dfaf5fe62196b6ce7f

commit c4a46d734d55fa04265506dfaf5fe62196b6ce7f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 06:28:49 2015 -0700

    Add i386 memcpy family multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=959d212b5cc74267fa0f7eda142c00f94e15458f

commit 959d212b5cc74267fa0f7eda142c00f94e15458f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Aug 19 14:10:40 2015 -0700

    Add i386 memset family multiarch functions

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=365e82879ebd6eec4fa84c47db5d1059d580cc4d

commit 365e82879ebd6eec4fa84c47db5d1059d580cc4d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Aug 17 10:19:05 2015 -0700

    Detect i586 and i686 features at run-time
    
    We detect i586 and i686 features at run-time by checking CX8 and CMOV
    CPUID features bits.  We can use these information to select the best
    implementation in ix86 multiarch.  Due to the reordering and the other
    nifty extensions in i686, it is not really good to use heavily i586
    optimized code on an i686.  It's better to use i486/i386 code if it
    isn't an i586.
    
    	* sysdeps/i386/init-arch.h: New file.
    	* sysdeps/i386/i486/init-arch.h: Likewise.
    	* sysdeps/i386/i586/init-arch.h: Likewise.
    	* sysdeps/i386/i686/init-arch.h: Likewise.
    	* sysdeps/x86/cpu-features.c (init_cpu_features): Set bit_I586
    	bit if CX8 is available.  Set bit_I686 bit if CMOV is available.
    	* sysdeps/x86/cpu-features.h (bit_I586): New.
    	(bit_I686): Likewise.
    	(bit_CX8): Likewise.
    	(bit_CMOV): Likewise.
    	(index_CX8): Likewise.
    	(index_CMOV): Likewise.
    	(index_I586): Likewise.
    	(index_I686): Likewise.
    	(reg_CX8): Likewise.
    	(reg_CMOV): Likewise.
    	(HAS_I586): Defined as HAS_ARCH_FEATURE (I586) if i586 isn't
    	available at compile-time.
    	(HAS_I686): Defined as HAS_ARCH_FEATURE (I686) if i686 isn't
    	available at compile-time.
    	* sysdeps/x86/init-arch.h (USE_I586): New macro.
    	(USE_I686): Likewise.

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d9ed8c6fb9fb69f88d1315d8c57b93f8bded9ed3

commit d9ed8c6fb9fb69f88d1315d8c57b93f8bded9ed3
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Aug 18 13:45:25 2015 -0700

    Add i386 memset and memcpy assembly functions
    
    Add i386 memset and memcpy assembly functions with REP MOVSB/STOSB
    instructions.
    
    	* sysdeps/i386/bcopy.S: New file.
    	* sysdeps/i386/bzero.S: Likewise.
    	* sysdeps/i386/memcpy.S: Likewise.
    	* sysdeps/i386/memmove.S: Likewise.
    	* sysdeps/i386/mempcpy.S: Likewise.
    	* sysdeps/i386/memset.S: Likewise.
    	* sysdeps/i386/bzero.c: Removed.
    	* sysdeps/i386/memset.c: Likewise.
    	* sysdeps/i386/i586/memcpy_chk.S: Likewise.
    	* sysdeps/i386/i586/mempcpy_chk.S: Likewise.
    	* sysdeps/i386/i586/memset_chk.S: Likewise.
    	* sysdeps/i386/i686/memcpy_chk.S: Moved to ...
    	* sysdeps/i386/memcpy_chk.S: Here.
    	* sysdeps/i386/i686/memmove_chk.S: Moved to ...
    	* sysdeps/i386/memmove_chk.S: Here.
    	* sysdeps/i386/i686/mempcpy_chk.S: Moved to ...
    	* sysdeps/i386/mempcpy_chk.S: Likewise.
    	* sysdeps/i386/i686/memset_chk.S: Moved to ...
    	* sysdeps/i386/memset_chk.S: Likewise.

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=81100cea4a76c82babbeda9c414ef3f47f48b967

commit 81100cea4a76c82babbeda9c414ef3f47f48b967
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 20 09:50:33 2015 -0700

    Replace MEMPCPY_P/PIC with USE_AS_MEMPCPY/SHARED
    
    Replace MEMPCPY_P with USE_AS_MEMPCPY in i586 memcpy.S to support i386
    multi-arch memcpy.  Also we should check SHARED not PIC for libc.so
    since libc.a may be compiled with PIC.
    
    	* sysdeps/i386/i586/memcpy.S (MEMPCPY_P): Removed.
    	Check USE_AS_MEMPCPY/SHARED instead of MEMPCPY_P/PIC.
    	* sysdeps/i386/i586/mempcpy.S (USE_AS_MEMPCPY): New.

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a57dad3d7c1fc9c1b795c83dedc3809918c4bddc

commit a57dad3d7c1fc9c1b795c83dedc3809918c4bddc
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Aug 19 13:43:30 2015 -0700

    Replace BZERO_P/PIC with USE_AS_BZERO/SHARED
    
    Replace BZERO_P with USE_AS_BZERO in i586/i686 memset.S to support i386
    multi-arch memset.  Also we should check SHARED not PIC for libc.so
    since libc.a may be compiled with PIC.
    
    	* sysdeps/i386/i586/bzero.S (USE_AS_BZERO): New.
    	* sysdeps/i386/i686/bzero.S (USE_AS_BZERO): Likewise.
    	* sysdeps/i386/i586/memset.S (BZERO_P): Removed.
    	Check USE_AS_BZERO/SHARED instead of BZERO_P/PIC.
    	(__memset_zero_constant_len_parameter): New.
    	* sysdeps/i386/i686/memset.S (BZERO_P): Removed.
    	Check USE_AS_BZERO/SHARED instead of BZERO_P/PIC.
    	(__memset_zero_constant_len_parameter): Don't define if
    	__memset_chk or USE_AS_BZERO are defined.

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=346823cdad1a889ce642d58e0ab3e11fcea0e824

commit 346823cdad1a889ce642d58e0ab3e11fcea0e824
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Aug 26 06:27:32 2015 -0700

    Avoid excess precision in check against float zero
    
    For check against float zero:
    
      float z;
      z = ...
      if (z == 0)
    
    on x86 with excess precision, we may get
    
    (gdb) info float
    =>R7: Valid   0x3d30e0d9b4d78a806800 +6.369668676344082156e-217
      R6: Empty   0x40029000000000000000
    
    and z (+6.369668676344082156e-217) == 0 is false.  We can avoid excess
    precision by checking binary representations of float zero directly.
    
    	[BZ #18875]
    	* sysdeps/i386/fpu/w_exp10f.c: New file.
    	* sysdeps/i386/fpu/w_exp2f.c: Likwise.
    	* sysdeps/i386/fpu/w_expf.c: Likwise.

-----------------------------------------------------------------------
Comment 4 cvs-commit@gcc.gnu.org 2015-09-14 22:01:15 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  903af5af9a0404c1dfeb7b4db6d5a23a1e45593f (commit)
      from  ca6be1655bd357bf6ac8857fba9b9dce928edbdc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=903af5af9a0404c1dfeb7b4db6d5a23a1e45593f

commit 903af5af9a0404c1dfeb7b4db6d5a23a1e45593f
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Mon Sep 14 22:00:12 2015 +0000

    Fix exp2 missing underflows (bug 16521).
    
    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.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                        |   25 ++
 NEWS                             |    8 +-
 math/auto-libm-test-in           |   23 ++
 math/auto-libm-test-out          |  575 ++++++++++++++++++++++++++++++++++++++
 math/e_exp2l.c                   |   12 +-
 sysdeps/i386/fpu/e_exp2.S        |   34 +++-
 sysdeps/i386/fpu/e_exp2f.S       |   34 +++-
 sysdeps/i386/fpu/e_exp2l.S       |   29 ++-
 sysdeps/ieee754/dbl-64/e_exp2.c  |   10 +-
 sysdeps/ieee754/flt-32/e_exp2f.c |   10 +-
 sysdeps/x86_64/fpu/e_exp2l.S     |   25 ++-
 11 files changed, 773 insertions(+), 12 deletions(-)
Comment 5 cvs-commit@gcc.gnu.org 2015-09-14 22:41:48 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  de5e81691c80468ff97c5260b4020aeaecfe418d (commit)
      from  903af5af9a0404c1dfeb7b4db6d5a23a1e45593f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=de5e81691c80468ff97c5260b4020aeaecfe418d

commit de5e81691c80468ff97c5260b4020aeaecfe418d
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Mon Sep 14 22:40:05 2015 +0000

    Fix i386 exp missing underflows (bug 18961).
    
    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.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                 |   15 ++
 NEWS                      |    2 +-
 math/auto-libm-test-in    |   11 +
 math/auto-libm-test-out   |  583 +++++++++++++++++++++++++++++++++++++++++++++
 sysdeps/i386/fpu/e_exp.S  |   53 ++++-
 sysdeps/i386/fpu/e_expf.S |   53 ++++-
 6 files changed, 712 insertions(+), 5 deletions(-)
Comment 6 cvs-commit@gcc.gnu.org 2015-09-15 16:51:07 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  828bf6828b048b1482e95f84ca92e5fe0edcdc0c (commit)
      from  333ceaa54bc27de48fc6eecc7b0a3e75a0c5ce50 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=828bf6828b048b1482e95f84ca92e5fe0edcdc0c

commit 828bf6828b048b1482e95f84ca92e5fe0edcdc0c
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Tue Sep 15 16:50:02 2015 +0000

    Fix i386 exp10 missing underflows (bug 18966).
    
    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.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                   |   15 ++++
 NEWS                        |    3 +-
 math/auto-libm-test-in      |    3 +
 math/auto-libm-test-out     |  163 +++++++++++++++++++++++++++++++++++++++++++
 sysdeps/i386/fpu/e_exp10.S  |   34 +++++++++-
 sysdeps/i386/fpu/e_exp10f.S |   34 +++++++++-
 6 files changed, 249 insertions(+), 3 deletions(-)
Comment 7 Joseph Myers 2015-09-15 16:52:35 UTC
I believe this should be fixed for 2.23 by my commits.  Please test and reopen if not.  (If you see such issues for other functions than those mentioned in this bug, please open a separate bug report.)