Merge release/2.26/master into ibm/2.26/master

This commit is contained in:
Gabriel F. T. Gomes 2017-08-21 16:29:58 -03:00
commit c9df582f3a
24 changed files with 286 additions and 45 deletions

View File

@ -1,3 +1,85 @@
2017-08-21 Florian Weimer <fweimer@redhat.com>
[BZ #21972]
* assert/assert.h (assert): Use static_cast (bool) for C++.
Use the ternary operator in the warning branch for GNU C.
* assert/Makefile (tests): Add tst-assert-c++, tst-assert-g++.
(CFLAGS-tst-assert-c++.o): Compile in C++11 mode.
(CFLAGS-tst-assert-g++.o): Compile in GnU C++11 mode.
(LDLIBS-tst-assert-c++, LDLIBS-tst-assert-g++): Link with libstdc++.
* assert/tst-assert-c++.cc, assert/tst-assert-g++.cc: New files.
2017-08-18 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
* misc/sys/cdefs.h (__HAVE_GENERIC_SELECTION): Define to 0, if
in C++ mode.
2017-08-18 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
[BZ #21930]
* math/math.h (isinf): Check if in C or C++ mode before using
__builtin_types_compatible_p, since this is a C mode feature.
2017-08-10 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
[BZ #21941]
* sysdeps/powerpc/fpu/math_private.h (__ieee754_sqrtf128): Since
xssqrtqp requires operands to be in Vector Registers
(Altivec/VMX), replace the register constraint 'wq' with 'v'.
* sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c
(__ieee754_sqrtf128): Likewise.
2017-08-11 Florian Weimer <fweimer@redhat.com>
[BZ #21242]
* assert/assert.h [__GNUC__ && !__STRICT_ANSI__] (assert):
Suppress pedantic warning resulting from statement expression.
(__ASSERT_FUNCTION): Add missing __extension__.
2017-08-10 Florian Weimer <fweimer@redhat.com>
* malloc/malloc.c (get_max_fast): Reimplement as an inline
function which calls __builtin_unreachable.
2017-08-09 Florian Weimer <fweimer@redhat.com>
[BZ #21932]
* nss/getXXbyYY_r.c (REENTRANT_NAME): Call __resolv_context_put
before early return.
2017-08-09 Adhemerval Zanella <adhemerval.zanella@linaro.org>
[BZ #21780]
* sysdeps/posix/preadv2.c (preadv2): Use ENOTSUP instead of
EOPNOTSUPP.
* sysdeps/posix/preadv64v2.c (preadv64v2): Likewise.
* sysdeps/posix/pwritev2.c (pwritev2): Likewise.
* sysdeps/posix/pwritev64v2.c (pwritev64v2): Likewise.
* sysdeps/unix/sysv/linux/preadv2.c (preadv2): Likewise.
* sysdeps/unix/sysv/linux/preadv64v2.c (preadv64v2): Likewise.
* sysdeps/unix/sysv/linux/pwritev2.c (pwritev2): Likewise.
* sysdeps/unix/sysv/linux/pwritev64v2.c (pwritev64v2): Likewise.
2017-08-06 H.J. Lu <hongjiu.lu@intel.com>
[BZ #21871]
* sysdeps/x86/cpu-features.c (init_cpu_features): Set
bit_arch_Use_dl_runtime_resolve_opt only with AVX512F.
2017-08-03 Aurelien Jarno <aurelien@aurel32.net>
* stdlib/getentropy.c (getentropy): Change return type to int.
2017-08-03 Aurelien Jarno <aurelien@aurel32.net>
* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Regenerated.
2017-08-03 Florian Weimer <fweimer@redhat.com>
[BZ #21885]
* sysdeps/posix/getaddrinfo.c (gethosts): Release resolver context
on memory allocation failure.
2017-08-02 Siddhesh Poyarekar <siddhesh@sourceware.org>
* version.h (RELEASE): Set to "stable"

13
NEWS
View File

@ -5,6 +5,19 @@ See the end for copying conditions.
Please send GNU C library bug reports via <http://sourceware.org/bugzilla/>
using `glibc' in the "product" field.
Version 2.26.1
The following bugs are resolved with this release:
[21242] assert: Suppress pedantic warning caused by statement expression
[21780] posix: Set p{read,write}v2 to return ENOTSUP
[21871] x86-64: Use _dl_runtime_resolve_opt only with AVX512F
[21885] getaddrinfo: Release resolver context on error in gethosts
[21930] Do not use __builtin_types_compatible_p in C++ mode
[21932] Unpaired __resolv_context_get in generic get*_r implementation
[21941] powerpc: Restrict xssqrtqp operands to Vector Registers
[21972] assert macro requires operator== (int) for its argument type
Version 2.26
Major new features:

View File

@ -25,6 +25,15 @@ include ../Makeconfig
headers := assert.h
routines := assert assert-perr __assert
tests := test-assert test-assert-perr
tests := test-assert test-assert-perr tst-assert-c++ tst-assert-g++
include ../Rules
ifeq ($(have-cxx-thread_local),yes)
CFLAGS-tst-assert-c++.o = -std=c++11
LDLIBS-tst-assert-c++ = -lstdc++
CFLAGS-tst-assert-g++.o = -std=gnu++11
LDLIBS-tst-assert-g++ = -lstdc++
else
tests-unsupported += tst-assert-c++ tst-assert-g++
endif

View File

@ -85,19 +85,29 @@ __END_DECLS
/* When possible, define assert so that it does not add extra
parentheses around EXPR. Otherwise, those added parentheses would
suppress warnings we'd expect to be detected by gcc's -Wparentheses. */
# if !defined __GNUC__ || defined __STRICT_ANSI__
# if defined __cplusplus
# define assert(expr) \
(static_cast <bool> (expr) \
? void (0) \
: __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION))
# elif !defined __GNUC__ || defined __STRICT_ANSI__
# define assert(expr) \
((expr) \
? __ASSERT_VOID_CAST (0) \
: __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION))
# else
/* The first occurrence of EXPR is not evaluated due to the sizeof,
but will trigger any pedantic warnings masked by the __extension__
for the second occurrence. The ternary operator is required to
support function pointers and bit fields in this context, and to
suppress the evaluation of variable length arrays. */
# define assert(expr) \
({ \
((void) sizeof ((expr) ? 1 : 0), __extension__ ({ \
if (expr) \
; /* empty */ \
else \
__assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION); \
})
}))
# endif
# ifdef __USE_GNU
@ -113,7 +123,7 @@ __END_DECLS
C9x has a similar variable called __func__, but prefer the GCC one since
it demangles C++ function names. */
# if defined __cplusplus ? __GNUC_PREREQ (2, 6) : __GNUC_PREREQ (2, 4)
# define __ASSERT_FUNCTION __PRETTY_FUNCTION__
# define __ASSERT_FUNCTION __extension__ __PRETTY_FUNCTION__
# else
# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
# define __ASSERT_FUNCTION __func__

78
assert/tst-assert-c++.cc Normal file
View File

@ -0,0 +1,78 @@
/* Tests for interactions between C++ and assert.
Copyright (C) 2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <assert.h>
/* The C++ standard requires that if the assert argument is a constant
subexpression, then the assert itself is one, too. */
constexpr int
check_constexpr ()
{
return (assert (true), 1);
}
/* Objects of this class can be contextually converted to bool, but
cannot be compared to int. */
struct no_int
{
no_int () = default;
no_int (const no_int &) = delete;
explicit operator bool () const
{
return true;
}
bool operator! () const; /* No definition. */
template <class T> bool operator== (T) const; /* No definition. */
template <class T> bool operator!= (T) const; /* No definition. */
};
/* This class tests that operator== is not used by assert. */
struct bool_and_int
{
bool_and_int () = default;
bool_and_int (const no_int &) = delete;
explicit operator bool () const
{
return true;
}
bool operator! () const; /* No definition. */
template <class T> bool operator== (T) const; /* No definition. */
template <class T> bool operator!= (T) const; /* No definition. */
};
static int
do_test ()
{
{
no_int value;
assert (value);
}
{
bool_and_int value;
assert (value);
}
return 0;
}
#include <support/test-driver.c>

19
assert/tst-assert-g++.cc Normal file
View File

@ -0,0 +1,19 @@
/* Tests for interactions between C++ and assert. GNU C++11 version.
Copyright (C) 2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <tst-assert-c++.cc>

View File

@ -1658,6 +1658,9 @@ typedef struct malloc_chunk *mfastbinptr;
#define arena_is_corrupt(A) (((A)->flags & ARENA_CORRUPTION_BIT))
#define set_arena_corrupt(A) ((A)->flags |= ARENA_CORRUPTION_BIT)
/* Maximum size of memory handled in fastbins. */
static INTERNAL_SIZE_T global_max_fast;
/*
Set value of max_fast.
Use impossibly small value if 0.
@ -1668,8 +1671,20 @@ typedef struct malloc_chunk *mfastbinptr;
#define set_max_fast(s) \
global_max_fast = (((s) == 0) \
? SMALLBIN_WIDTH : ((s + SIZE_SZ) & ~MALLOC_ALIGN_MASK))
#define get_max_fast() global_max_fast
static inline INTERNAL_SIZE_T
get_max_fast (void)
{
/* Tell the GCC optimizers that global_max_fast is never larger
than MAX_FAST_SIZE. This avoids out-of-bounds array accesses in
_int_malloc after constant propagation of the size parameter.
(The code never executes because malloc preserves the
global_max_fast invariant, but the optimizers may not recognize
this.) */
if (global_max_fast > MAX_FAST_SIZE)
__builtin_unreachable ();
return global_max_fast;
}
/*
----------- Internal state representation and initialization -----------
@ -1797,9 +1812,6 @@ static struct malloc_par mp_ =
#endif
};
/* Maximum size of memory handled in fastbins. */
static INTERNAL_SIZE_T global_max_fast;
/*
Initialize a malloc_state struct.

View File

@ -442,8 +442,12 @@ enum
/* Return nonzero value if X is positive or negative infinity. */
# if __HAVE_DISTINCT_FLOAT128 && !__GNUC_PREREQ (7,0) \
&& !defined __SUPPORT_SNAN__
/* __builtin_isinf_sign is broken for float128 only before GCC 7.0. */
&& !defined __SUPPORT_SNAN__ && !defined __cplusplus
/* Since __builtin_isinf_sign is broken for float128 before GCC 7.0,
use the helper function, __isinff128, with older compilers. This is
only provided for C mode, because in C++ mode, GCC has no support
for __builtin_types_compatible_p (and when in C++ mode, this macro is
not used anyway, because libstdc++ headers undefine it). */
# define isinf(x) \
(__builtin_types_compatible_p (__typeof (x), _Float128) \
? __isinff128 (x) : __builtin_isinf_sign (x))

View File

@ -464,17 +464,18 @@
# define __glibc_macro_warning(msg)
#endif
/* Support for generic selection (ISO C11) is available in GCC since
version 4.9. Previous versions do not provide generic selection,
even though they might set __STDC_VERSION__ to 201112L, when in
-std=c11 mode. Thus, we must check for !defined __GNUC__ when
testing __STDC_VERSION__ for generic selection support.
/* Generic selection (ISO C11) is a C-only feature, available in GCC
since version 4.9. Previous versions do not provide generic
selection, even though they might set __STDC_VERSION__ to 201112L,
when in -std=c11 mode. Thus, we must check for !defined __GNUC__
when testing __STDC_VERSION__ for generic selection support.
On the other hand, Clang also defines __GNUC__, so a clang-specific
check is required to enable the use of generic selection. */
#if __GNUC_PREREQ (4, 9) \
|| __glibc_clang_has_extension (c_generic_selections) \
|| (!defined __GNUC__ && defined __STDC_VERSION__ \
&& __STDC_VERSION__ >= 201112L)
#if !defined __cplusplus \
&& (__GNUC_PREREQ (4, 9) \
|| __glibc_clang_has_extension (c_generic_selections) \
|| (!defined __GNUC__ && defined __STDC_VERSION__ \
&& __STDC_VERSION__ >= 201112L))
# define __HAVE_GENERIC_SELECTION 1
#else
# define __HAVE_GENERIC_SELECTION 0

View File

@ -234,6 +234,9 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
H_ERRNO_VAR_P))
{
case -1:
# ifdef NEED__RES
__resolv_context_put (res_ctx);
# endif
return errno;
case 1:
#ifdef NEED_H_ERRNO
@ -253,7 +256,12 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
nscd_status = NSCD_NAME (ADD_VARIABLES, resbuf, buffer, buflen, result
H_ERRNO_VAR);
if (nscd_status >= 0)
return nscd_status;
{
# ifdef NEED__RES
__resolv_context_put (res_ctx);
# endif
return nscd_status;
}
}
#endif

View File

@ -21,7 +21,7 @@
/* Write LENGTH bytes of randomness starting at BUFFER. Return 0 on
success and -1 on failure. */
ssize_t
int
getentropy (void *buffer, size_t length)
{
__set_errno (ENOSYS);

View File

@ -58,7 +58,7 @@ double: 1
float128: 2
idouble: 1
ifloat128: 2
ildouble: 4
ildouble: 5
ldouble: 3
Function: "asin":
@ -1154,8 +1154,8 @@ float128: 4
idouble: 3
ifloat: 3
ifloat128: 4
ildouble: 7
ldouble: 7
ildouble: 8
ldouble: 8
Function: Imaginary part of "clog10_upward":
double: 1
@ -2013,8 +2013,8 @@ double: 3
float: 4
idouble: 3
ifloat: 4
ildouble: 5
ldouble: 5
ildouble: 6
ldouble: 6
Function: "hypot":
double: 1
@ -2205,8 +2205,8 @@ float128: 8
idouble: 3
ifloat: 4
ifloat128: 8
ildouble: 5
ldouble: 5
ildouble: 6
ldouble: 6
Function: "log":
double: 1

View File

@ -255,6 +255,8 @@ convert_hostent_to_gaih_addrtuple (const struct addrinfo *req,
break; \
if (!scratch_buffer_grow (tmpbuf)) \
{ \
__resolv_context_enable_inet6 (res_ctx, res_enable_inet6); \
__resolv_context_put (res_ctx); \
result = -EAI_MEMORY; \
goto free_and_return; \
} \

View File

@ -28,7 +28,7 @@ preadv2 (int fd, const struct iovec *vector, int count, OFF_T offset,
{
if (flags != 0)
{
__set_errno (EOPNOTSUPP);
__set_errno (ENOTSUP);
return -1;
}

View File

@ -25,7 +25,7 @@ preadv64v2 (int fd, const struct iovec *vector, int count, OFF_T offset,
{
if (flags != 0)
{
__set_errno (EOPNOTSUPP);
__set_errno (ENOTSUP);
return -1;
}

View File

@ -28,7 +28,7 @@ pwritev2 (int fd, const struct iovec *vector, int count, OFF_T offset,
{
if (flags != 0)
{
__set_errno (EOPNOTSUPP);
__set_errno (ENOTSUP);
return -1;
}

View File

@ -26,7 +26,7 @@ pwritev64v2 (int fd, const struct iovec *vector, int count, OFF_T offset,
{
if (flags != 0)
{
__set_errno (EOPNOTSUPP);
__set_errno (ENOTSUP);
return -1;
}

View File

@ -30,7 +30,7 @@ extern __always_inline _Float128
__ieee754_sqrtf128 (_Float128 __x)
{
_Float128 __z;
asm ("xssqrtqp %0,%1" : "=wq" (__z) : "wq" (__x));
asm ("xssqrtqp %0,%1" : "=v" (__z) : "v" (__x));
return __z;
}
#endif

View File

@ -30,7 +30,7 @@ __float128
__ieee754_sqrtf128 (__float128 a)
{
__float128 z;
asm ("xssqrtqp %0,%1" : "=wq" (z) : "wq" (a));
asm ("xssqrtqp %0,%1" : "=v" (z) : "v" (a));
return z;
}
strong_alias (__ieee754_sqrtf128, __sqrtf128_finite)

View File

@ -32,7 +32,7 @@ preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
# ifdef __NR_preadv2
ssize_t result = SYSCALL_CANCEL (preadv2, fd, vector, count,
LO_HI_LONG (offset), flags);
if (result >= 0 || errno != ENOSYS)
if (result >= 0)
return result;
# endif
/* Trying to emulate the preadv2 syscall flags is troublesome:
@ -46,7 +46,7 @@ preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
if (flags != 0)
{
__set_errno (EOPNOTSUPP);
__set_errno (ENOTSUP);
return -1;
}
return preadv (fd, vector, count, offset);

View File

@ -30,7 +30,7 @@ preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
#ifdef __NR_preadv64v2
ssize_t result = SYSCALL_CANCEL (preadv64v2, fd, vector, count,
LO_HI_LONG (offset), flags);
if (result >= 0 || errno != ENOSYS)
if (result >= 0)
return result;
#endif
/* Trying to emulate the preadv2 syscall flags is troublesome:
@ -44,7 +44,7 @@ preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
if (flags != 0)
{
__set_errno (EOPNOTSUPP);
__set_errno (ENOTSUP);
return -1;
}
return preadv64 (fd, vector, count, offset);

View File

@ -28,7 +28,7 @@ pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
# ifdef __NR_pwritev2
ssize_t result = SYSCALL_CANCEL (pwritev2, fd, vector, count,
LO_HI_LONG (offset), flags);
if (result >= 0 || errno != ENOSYS)
if (result >= 0)
return result;
# endif
/* Trying to emulate the pwritev2 syscall flags is troublesome:
@ -42,7 +42,7 @@ pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
if (flags != 0)
{
__set_errno (EOPNOTSUPP);
__set_errno (ENOTSUP);
return -1;
}
return pwritev (fd, vector, count, offset);

View File

@ -30,7 +30,7 @@ pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
#ifdef __NR_pwritev64v2
ssize_t result = SYSCALL_CANCEL (pwritev64v2, fd, vector, count,
LO_HI_LONG (offset), flags);
if (result >= 0 || errno != ENOSYS)
if (result >= 0)
return result;
#endif
/* Trying to emulate the pwritev2 syscall flags is troublesome:
@ -44,7 +44,7 @@ pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
if (flags != 0)
{
__set_errno (EOPNOTSUPP);
__set_errno (ENOTSUP);
return -1;
}
return pwritev64 (fd, vector, count, offset);

View File

@ -244,10 +244,13 @@ init_cpu_features (struct cpu_features *cpu_features)
|= bit_arch_Prefer_No_AVX512;
/* To avoid SSE transition penalty, use _dl_runtime_resolve_slow.
If XGETBV suports ECX == 1, use _dl_runtime_resolve_opt. */
If XGETBV suports ECX == 1, use _dl_runtime_resolve_opt.
Use _dl_runtime_resolve_opt only with AVX512F since it is
slower than _dl_runtime_resolve_slow with AVX. */
cpu_features->feature[index_arch_Use_dl_runtime_resolve_slow]
|= bit_arch_Use_dl_runtime_resolve_slow;
if (cpu_features->max_cpuid >= 0xd)
if (CPU_FEATURES_ARCH_P (cpu_features, AVX512F_Usable)
&& cpu_features->max_cpuid >= 0xd)
{
unsigned int eax;