This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug malloc/22052] malloc failed to compile with GCC 7 and -O3


https://sourceware.org/bugzilla/show_bug.cgi?id=22052

--- Comment #4 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, release/2.26/master has been updated
       via  73a92363619e52c458146e903dfb9b1ba823aa40 (commit)
      from  df8c219cb987cfe85c550efa693a1383a11e38aa (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=73a92363619e52c458146e903dfb9b1ba823aa40

commit 73a92363619e52c458146e903dfb9b1ba823aa40
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Dec 6 16:15:47 2017 +0100

    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;

    due to the GCC bug:

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82090

    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 with GCC 7.

    (cherry picked from commit 8e57c9432a2b68c8a1e7f4df28f0e8c7acc04753)

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

Summary of changes:
 ChangeLog      |    6 ++++++
 NEWS           |    1 +
 malloc/hooks.c |    7 +++++++
 3 files changed, 14 insertions(+), 0 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]