This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug malloc/22052] malloc failed to compile with GCC 7 and -O3
- From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Sun, 15 Oct 2017 15:01:09 +0000
- Subject: [Bug malloc/22052] malloc failed to compile with GCC 7 and -O3
- Auto-submitted: auto-generated
- References: <bug-22052-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=22052
--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
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/pr22298/master has been created
at 16be5568a0c24b9bd1ade7fa937c94b5d53b6ab1 (commit)
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=16be5568a0c24b9bd1ade7fa937c94b5d53b6ab1
commit 16be5568a0c24b9bd1ade7fa937c94b5d53b6ab1
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sun Oct 15 07:48:58 2017 -0700
Define __PTHREAD_MUTEX_HAVE_PREV only if undefined [BZ #22298]
It is incorrect to define __PTHREAD_MUTEX_HAVE_PREV to 1 only when
__WORDSIZE == 64. For x32, __PTHREAD_MUTEX_HAVE_PREV should be 1, but
it has __WORDSIZE == 32. This patch defines __PTHREAD_MUTEX_HAVE_PREV
based on __WORDSIZE only if it is undefined. __PTHREAD_MUTEX_HAVE_PREV
check is changed from "#ifdef" to "#if" to support values of 0 or 1.
[BZ #22298]
* nptl/allocatestack.c (allocate_stack): Check if
__PTHREAD_MUTEX_HAVE_PREV is non-zero, instead if
__PTHREAD_MUTEX_HAVE_PREV is defined.
* nptl/descr.h (pthread): Likewise.
* nptl/nptl-init.c (__pthread_initialize_minimal_internal):
Likewise.
* nptl/pthread_create.c (START_THREAD_DEFN): Likewise.
* sysdeps/nptl/fork.c (__libc_fork): Likewise.
* sysdeps/nptl/pthread.h (PTHREAD_MUTEX_INITIALIZER): Likewise.
* sysdeps/nptl/bits/thread-shared-types.h
(__PTHREAD_MUTEX_HAVE_PREV): Define only if it is undefined.
(__pthread_internal_list): Check __pthread_internal_list instead
of __WORDSIZE.
(__PTHREAD_SPINS_DATA): Likewise.
(__PTHREAD_SPINS): Likewise.
(__pthread_mutex_s): Likewise.
* sysdeps/x86/nptl/bits/pthreadtypes-arch.h
(__PTHREAD_MUTEX_HAVE_PREV): Defined.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=df44f9d02b68de45ba8c3984f47ecf1a523306ec
commit df44f9d02b68de45ba8c3984f47ecf1a523306ec
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sun Oct 15 07:23:41 2017 -0700
x32: Verify that NPTL structures are correct [BZ #22298]
Add a build-time check to verify that NPTL structures are correct.
* sysdeps/x86_64/x32/nptl/Makefile: New file.
* sysdeps/x86_64/x32/nptl/nptl-check.sym: Likewise.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=aca3e9b42f9c172af368f2fc54d2c7299b231cc0
commit aca3e9b42f9c172af368f2fc54d2c7299b231cc0
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sun Sep 3 08:39:55 2017 -0700
Silence -O3 -Wall warning in malloc/hooks.c with GCC 7 [BZ #22052]
realloc_check has
unsigned char *magic_p;
...
__libc_lock_lock (main_arena.mutex);
const mchunkptr oldp = mem2chunk_check (oldmem, &magic_p);
__libc_lock_unlock (main_arena.mutex);
if (!oldp)
malloc_printerr ("realloc(): invalid pointer");
...
if (newmem == NULL)
*magic_p ^= 0xFF;
with
static void malloc_printerr(const char *str) __attribute__ ((noreturn));
GCC 7 -O3 warns
hooks.c: In function ‘realloc_check’:
hooks.c:352:14: error: ‘magic_p’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
*magic_p ^= 0xFF;
This patch silences GCC 7 by using DIAG_IGNORE_NEEDS_COMMENT.
[BZ #22052]
* malloc/hooks.c (realloc_check): Use DIAG_IGNORE_NEEDS_COMMENT
to silence -O3 -Wall warning GCC 7.
-----------------------------------------------------------------------
--
You are receiving this mail because:
You are on the CC list for the bug.