Carlos O'Donell 0457f6
Index: glibc-2.22-193-g315267a/resolv/gethnamaddr.c
Carlos O'Donell 0457f6
===================================================================
Carlos O'Donell 0457f6
--- glibc-2.22-193-g315267a.orig/resolv/gethnamaddr.c
Carlos O'Donell 0457f6
+++ glibc-2.22-193-g315267a/resolv/gethnamaddr.c
Carlos O'Donell 0457f6
@@ -71,6 +71,7 @@ static char sccsid[] = "@(#)gethostnamad
Carlos O'Donell 0457f6
 #include <ctype.h>
Carlos O'Donell 0457f6
 #include <errno.h>
Carlos O'Donell 0457f6
 #include <syslog.h>
Carlos O'Donell 0457f6
+#include <libc-internal.h>
Carlos O'Donell 0457f6
 
Carlos O'Donell 0457f6
 #define RESOLVSORT
Carlos O'Donell 0457f6
 
Carlos O'Donell 0457f6
@@ -986,10 +987,19 @@ addrsort(ap, num)
Carlos O'Donell 0457f6
 
Carlos O'Donell 0457f6
 	p = ap;
Carlos O'Donell 0457f6
 	for (i = 0; i < num; i++, p++) {
Carlos O'Donell 0457f6
+	    DIAG_PUSH_NEEDS_COMMENT
Carlos O'Donell 0457f6
+#if __GNUC_PREREQ (5, 0)
Carlos O'Donell 0457f6
+	    /* GCC 5.0 warns about array subscript being above array bounds,
Carlos O'Donell 0457f6
+	       but that's not entirely possible since i is limited to
Carlos O'Donell 0457f6
+	       _res.nsort which is limited to MAXRESOLVSORT. This
Carlos O'Donell 0457f6
+	       is likely PR/59124 which is still not fixed.  */
Carlos O'Donell 0457f6
+	    DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
Carlos O'Donell 0457f6
+#endif
Carlos O'Donell 0457f6
 	    for (j = 0 ; (unsigned)j < _res.nsort; j++)
Carlos O'Donell 0457f6
 		if (_res.sort_list[j].addr.s_addr ==
Carlos O'Donell 0457f6
 		    (((struct in_addr *)(*p))->s_addr & _res.sort_list[j].mask))
Carlos O'Donell 0457f6
 			break;
Carlos O'Donell 0457f6
+	    DIAG_POP_NEEDS_COMMENT
Carlos O'Donell 0457f6
 	    aval[i] = j;
Carlos O'Donell 0457f6
 	    if (needsort == 0 && i > 0 && j < aval[i-1])
Carlos O'Donell 0457f6
 		needsort = i;