From patchwork Fri May 15 16:42:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 6747 Received: (qmail 113764 invoked by alias); 15 May 2015 16:44:02 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 113753 invoked by uid 89); 15 May 2015 16:44:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mailapp01.imgtec.com Message-ID: <1431708170.16668.8.camel@ubuntu-sellcey> Subject: Incomplete patch to fix build with top-of-tree GCC From: Steve Ellcey Reply-To: To: GNU C Library Date: Fri, 15 May 2015 09:42:50 -0700 MIME-Version: 1.0 I was wondering if anyone can help me with a patch to fix the glibc build with the latest GCC. A recent GCC patch to fix middle-end/66110 caused us to get some new strict-aliasing errors. I can do the mechanical change to use the DIAG_* macros to allow the non-strict-aliasing but the macros need to be accompanied by a comment about why it is OK to ignore the warnings and I am not sure how to write a coherent explanation of that since I am not familiar with the code in question. Here is the patch I have so far with no comments, does any one want to help finish it by adding some comments? Steve Ellcey sellcey@imgtec.com 2015-05-15 Steve Ellcey * inet/rcmd.c (__ivaliduser): Ignore strict-aliasing. (iruserok_af): Ditto. * libio/memstream.c (open_memstream): Ditto. * libio/oldiofdopen.c (_IO_old_fdopen): Ditto. * libio/oldiofopen.c (_IO_old_fopen): Ditto. * libio/oldiopopen.c (_IO_old_popen): Ditto. * resolv/res_hconf.c (_res_hconf_reorder_addrs): Ditto. diff --git a/inet/rcmd.c b/inet/rcmd.c index acacaa0..f2c04b7 100644 --- a/inet/rcmd.c +++ b/inet/rcmd.c @@ -82,6 +82,7 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94"; #include #include #include +#include int __ivaliduser (FILE *, u_int32_t, const char *, const char *); @@ -382,11 +383,17 @@ rresvport_af(alport, family) switch(family){ case AF_INET: len = sizeof(struct sockaddr_in); + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (5, "-Wstrict-aliasing"); sport = &((struct sockaddr_in *)&ss)->sin_port; + DIAG_POP_NEEDS_COMMENT; break; case AF_INET6: len = sizeof(struct sockaddr_in6); + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (5, "-Wstrict-aliasing"); sport = &((struct sockaddr_in6 *)&ss)->sin6_port; + DIAG_POP_NEEDS_COMMENT; break; default: __set_errno (EAFNOSUPPORT); @@ -611,14 +618,20 @@ iruserok_af (raddr, superuser, ruser, luser, af) switch (af){ case AF_INET: ra.ss_family = AF_INET; + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (5, "-Wstrict-aliasing"); memcpy (&(((struct sockaddr_in *)&ra)->sin_addr), raddr, sizeof(struct in_addr)); + DIAG_POP_NEEDS_COMMENT; ralen = sizeof(struct sockaddr_in); break; case AF_INET6: ra.ss_family = AF_INET6; + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (5, "-Wstrict-aliasing"); memcpy (&(((struct sockaddr_in6 *)&ra)->sin6_addr), raddr, sizeof(struct in6_addr)); + DIAG_POP_NEEDS_COMMENT; ralen = sizeof(struct sockaddr_in6); break; default: diff --git a/libio/memstream.c b/libio/memstream.c index e1c5434..b6abf6f 100644 --- a/libio/memstream.c +++ b/libio/memstream.c @@ -19,6 +19,7 @@ #include "strfile.h" #include #include +#include struct _IO_FILE_memstream @@ -89,7 +90,10 @@ open_memstream (bufloc, sizeloc) return NULL; } _IO_init (&new_f->fp._sf._sbf._f, 0); + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (5, "-Wstrict-aliasing"); _IO_JUMPS ((struct _IO_FILE_plus *) &new_f->fp._sf._sbf) = &_IO_mem_jumps; + DIAG_POP_NEEDS_COMMENT; _IO_str_init_static_internal (&new_f->fp._sf, buf, _IO_BUFSIZ, buf); new_f->fp._sf._sbf._f._flags &= ~_IO_USER_BUF; new_f->fp._sf._s._allocate_buffer = (_IO_alloc_type) malloc; diff --git a/libio/oldiofdopen.c b/libio/oldiofdopen.c index e0d5354..56520f6 100644 --- a/libio/oldiofdopen.c +++ b/libio/oldiofdopen.c @@ -31,6 +31,7 @@ #include #include "libioP.h" #include +#include #ifndef _IO_fcntl # define _IO_fcntl __fcntl @@ -113,7 +114,10 @@ _IO_old_fdopen (fd, mode) new_f->fp.file._file._lock = &new_f->lock; #endif _IO_old_init (&new_f->fp.file._file, 0); + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (5, "-Wstrict-aliasing"); _IO_JUMPS ((struct _IO_FILE_plus *) &new_f->fp) = &_IO_old_file_jumps; + DIAG_POP_NEEDS_COMMENT; _IO_old_file_init ((struct _IO_FILE_plus *) &new_f->fp); #if !_IO_UNIFIED_JUMPTABLES new_f->fp.vtable = NULL; diff --git a/libio/oldiofopen.c b/libio/oldiofopen.c index dac424a..be6df8f 100644 --- a/libio/oldiofopen.c +++ b/libio/oldiofopen.c @@ -30,6 +30,7 @@ #define _IO_USE_OLD_IO_FILE #include "libioP.h" #include +#include _IO_FILE * @@ -52,7 +53,10 @@ _IO_old_fopen (filename, mode) new_f->fp.file._file._lock = &new_f->lock; #endif _IO_old_init (&new_f->fp.file._file, 0); + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (5, "-Wstrict-aliasing"); _IO_JUMPS ((struct _IO_FILE_plus *) &new_f->fp) = &_IO_old_file_jumps; + DIAG_POP_NEEDS_COMMENT; _IO_old_file_init ((struct _IO_FILE_plus *) &new_f->fp); #if !_IO_UNIFIED_JUMPTABLES new_f->fp.vtable = NULL; diff --git a/libio/oldiopopen.c b/libio/oldiopopen.c index f6bcf5d..e89c761 100644 --- a/libio/oldiopopen.c +++ b/libio/oldiopopen.c @@ -38,6 +38,7 @@ #endif #include #include +#include #ifndef _IO_fork #ifdef _LIBC @@ -215,7 +216,10 @@ _IO_old_popen (command, mode) #endif fp = &new_f->fpx.file.file._file; _IO_old_init (fp, 0); + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (5, "-Wstrict-aliasing"); _IO_JUMPS ((struct _IO_FILE_plus *) &new_f->fpx.file) = &_IO_old_proc_jumps; + DIAG_POP_NEEDS_COMMENT; _IO_old_file_init ((struct _IO_FILE_plus *) &new_f->fpx.file); #if !_IO_UNIFIED_JUMPTABLES new_f->fpx.file.vtable = NULL; diff --git a/resolv/res_hconf.c b/resolv/res_hconf.c index 73942e8..7ce819f 100644 --- a/resolv/res_hconf.c +++ b/resolv/res_hconf.c @@ -45,6 +45,7 @@ #include "ifreq.h" #include "res_hconf.h" #include +#include #if IS_IN (libc) # define fgets_unlocked __fgets_unlocked @@ -443,14 +444,20 @@ _res_hconf_reorder_addrs (struct hostent *hp) continue; ifaddrs[new_num_ifs].addrtype = AF_INET; + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (5, "-Wstrict-aliasing"); ifaddrs[new_num_ifs].u.ipv4.addr = ((struct sockaddr_in *) &cur_ifr->ifr_addr)->sin_addr.s_addr; + DIAG_POP_NEEDS_COMMENT; if (__ioctl (sd, SIOCGIFNETMASK, cur_ifr) < 0) continue; + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (5, "-Wstrict-aliasing"); ifaddrs[new_num_ifs].u.ipv4.mask = ((struct sockaddr_in *) &cur_ifr->ifr_netmask)->sin_addr.s_addr; + DIAG_POP_NEEDS_COMMENT; /* Now we're committed to this entry. */ ++new_num_ifs;