Carlos O'Donell fe4ad2
Index: glibc-2.23-276-gb65b205/resolv/nss_dns/dns-host.c
Carlos O'Donell 0457f6
===================================================================
Carlos O'Donell fe4ad2
--- glibc-2.23-276-gb65b205.orig/resolv/nss_dns/dns-host.c
Carlos O'Donell fe4ad2
+++ glibc-2.23-276-gb65b205/resolv/nss_dns/dns-host.c
Carlos O'Donell fe4ad2
@@ -78,6 +78,7 @@
Carlos O'Donell fe4ad2
 #include <stdlib.h>
Carlos O'Donell 0457f6
 #include <stddef.h>
Carlos O'Donell 0457f6
 #include <string.h>
Carlos O'Donell 0457f6
+#include <libc-internal.h>
Carlos O'Donell 0457f6
 
Carlos O'Donell 0457f6
 #include "nsswitch.h"
Carlos O'Donell 0457f6
 
Carlos O'Donell fe4ad2
@@ -566,10 +567,19 @@ addrsort (char **ap, int num)
Carlos O'Donell 0457f6
     num = MAX_NR_ADDRS;
Carlos O'Donell 0457f6
   for (i = 0; i < num; i++, p++)
Carlos O'Donell 0457f6
     {
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;