Carlos O'Donell 0457f64
Index: glibc-2.22-193-g315267a/locale/programs/ld-ctype.c
Carlos O'Donell 0457f64
===================================================================
Carlos O'Donell 0457f64
--- glibc-2.22-193-g315267a.orig/locale/programs/ld-ctype.c
Carlos O'Donell 0457f64
+++ glibc-2.22-193-g315267a/locale/programs/ld-ctype.c
Carlos O'Donell 0457f64
@@ -31,6 +31,7 @@
Carlos O'Donell 0457f64
 #include <wctype.h>
Carlos O'Donell 0457f64
 #include <stdint.h>
Carlos O'Donell 0457f64
 #include <sys/uio.h>
Carlos O'Donell 0457f64
+#include <libc-internal.h>
Carlos O'Donell 0457f64
 
Carlos O'Donell 0457f64
 #include "localedef.h"
Carlos O'Donell 0457f64
 #include "charmap.h"
Carlos O'Donell 0457f64
@@ -2534,9 +2535,19 @@ with character code range values one mus
Carlos O'Donell 0457f64
 	    {
Carlos O'Donell 0457f64
 	      size_t cnt;
Carlos O'Donell 0457f64
 
Carlos O'Donell 0457f64
+	      DIAG_PUSH_NEEDS_COMMENT
Carlos O'Donell 0457f64
+#if __GNUC_PREREQ (5, 0)
Carlos O'Donell 0457f64
+		/* GCC 5.0 warns about array subscript being above array bounds,
Carlos O'Donell 0457f64
+		   but that's not possible since ctype_map_new prevents
Carlos O'Donell 0457f64
+		   map_collection_nr from being greater than MAX_NR_CHARMP which
Carlos O'Donell 0457f64
+		   is the size of mapnames. This is likely PR/59124 which is still
Carlos O'Donell 0457f64
+		   not fixed.  */
Carlos O'Donell 0457f64
+	      DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
Carlos O'Donell 0457f64
+#endif
Carlos O'Donell 0457f64
 	      for (cnt = 2; cnt < ctype->map_collection_nr; ++cnt)
Carlos O'Donell 0457f64
 		if (strcmp (now->val.str.startmb, ctype->mapnames[cnt]) == 0)
Carlos O'Donell 0457f64
 		  break;
Carlos O'Donell 0457f64
+	      DIAG_POP_NEEDS_COMMENT
Carlos O'Donell 0457f64
 
Carlos O'Donell 0457f64
 	      if (cnt < ctype->map_collection_nr)
Carlos O'Donell 0457f64
 		free (now->val.str.startmb);
Carlos O'Donell 0457f64
@@ -2807,9 +2818,19 @@ previous definition was here")));
Carlos O'Donell 0457f64
 
Carlos O'Donell 0457f64
 	  /* This could mean one of several things.  First test whether
Carlos O'Donell 0457f64
 	     it's a character class name.  */
Carlos O'Donell 0457f64
+	  DIAG_PUSH_NEEDS_COMMENT
Carlos O'Donell 0457f64
+#if __GNUC_PREREQ (5, 0)
Carlos O'Donell 0457f64
+	    /* GCC 5.0 warns about array subscript being above array bounds,
Carlos O'Donell 0457f64
+	       but that's not possible since ctype_class_new prevents
Carlos O'Donell 0457f64
+	       nr_charclass from being greater than MAX_NR_CHARCLASS which
Carlos O'Donell 0457f64
+	       is the size of classnames. This is likely PR/59124 which is still
Carlos O'Donell 0457f64
+	       not fixed.  */
Carlos O'Donell 0457f64
+	  DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
Carlos O'Donell 0457f64
+#endif
Carlos O'Donell 0457f64
 	  for (cnt = 0; cnt < ctype->nr_charclass; ++cnt)
Carlos O'Donell 0457f64
 	    if (strcmp (now->val.str.startmb, ctype->classnames[cnt]) == 0)
Carlos O'Donell 0457f64
 	      break;
Carlos O'Donell 0457f64
+	  DIAG_POP_NEEDS_COMMENT
Carlos O'Donell 0457f64
 	  if (cnt < ctype->nr_charclass)
Carlos O'Donell 0457f64
 	    {
Carlos O'Donell 0457f64
 	      class_bit = _ISwbit (cnt);
Carlos O'Donell 0457f64
@@ -2817,9 +2838,19 @@ previous definition was here")));
Carlos O'Donell 0457f64
 	      free (now->val.str.startmb);
Carlos O'Donell 0457f64
 	      goto read_charclass;
Carlos O'Donell 0457f64
 	    }
Carlos O'Donell 0457f64
+	  DIAG_PUSH_NEEDS_COMMENT
Carlos O'Donell 0457f64
+#if __GNUC_PREREQ (5, 0)
Carlos O'Donell 0457f64
+	  /* GCC 5.0 warns about array subscript being above array bounds,
Carlos O'Donell 0457f64
+	     but that's not possible since ctype_map_new prevents
Carlos O'Donell 0457f64
+	     map_collection_nr from being greater than MAX_NR_CHARMP which
Carlos O'Donell 0457f64
+	     is the size of mapnames. This is likely PR/59124 which is still
Carlos O'Donell 0457f64
+	     not fixed.  */
Carlos O'Donell 0457f64
+	  DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
Carlos O'Donell 0457f64
+#endif
Carlos O'Donell 0457f64
 	  for (cnt = 0; cnt < ctype->map_collection_nr; ++cnt)
Carlos O'Donell 0457f64
 	    if (strcmp (now->val.str.startmb, ctype->mapnames[cnt]) == 0)
Carlos O'Donell 0457f64
 	      break;
Carlos O'Donell 0457f64
+	  DIAG_POP_NEEDS_COMMENT
Carlos O'Donell 0457f64
 	  if (cnt < ctype->map_collection_nr)
Carlos O'Donell 0457f64
 	    {
Carlos O'Donell 0457f64
 	      mapidx = cnt;