Carlos O'Donell 0457f64
Index: glibc-2.22-193-g315267a/posix/bug-regex11.c
Carlos O'Donell 0457f64
===================================================================
Carlos O'Donell 0457f64
--- glibc-2.22-193-g315267a.orig/posix/bug-regex11.c
Carlos O'Donell 0457f64
+++ glibc-2.22-193-g315267a/posix/bug-regex11.c
Carlos O'Donell 0457f64
@@ -22,6 +22,7 @@
Carlos O'Donell 0457f64
 #include <regex.h>
Carlos O'Donell 0457f64
 #include <stdio.h>
Carlos O'Donell 0457f64
 #include <stdlib.h>
Carlos O'Donell 0457f64
+#include <libc-internal.h>
Carlos O'Donell 0457f64
 
Carlos O'Donell 0457f64
 /* Tests supposed to match.  */
Carlos O'Donell 0457f64
 struct
Carlos O'Donell 0457f64
@@ -119,6 +120,14 @@ main (void)
Carlos O'Donell 0457f64
 	  continue;
Carlos O'Donell 0457f64
 	}
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 entirely possible since n is limited to
Carlos O'Donell 0457f64
+	 static nmatch which is limited to at most 5 (see tests above).
Carlos O'Donell 0457f64
+	 This is likely PR/59124 which is still not fixed.  */
Carlos O'Donell 0457f64
+      DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
Carlos O'Donell 0457f64
+#endif
Carlos O'Donell 0457f64
       for (n = 0; n < tests[i].nmatch; ++n)
Carlos O'Donell 0457f64
 	if (rm[n].rm_so != tests[i].rm[n].rm_so
Carlos O'Donell 0457f64
               || rm[n].rm_eo != tests[i].rm[n].rm_eo)
Carlos O'Donell 0457f64
@@ -130,6 +139,7 @@ main (void)
Carlos O'Donell 0457f64
 	    ret = 1;
Carlos O'Donell 0457f64
 	    break;
Carlos O'Donell 0457f64
 	  }
Carlos O'Donell 0457f64
+      DIAG_POP_NEEDS_COMMENT
Carlos O'Donell 0457f64
 
Carlos O'Donell 0457f64
       regfree (&re);
Carlos O'Donell 0457f64
     }
Carlos O'Donell 0457f64
Index: glibc-2.22-193-g315267a/posix/bug-regex17.c
Carlos O'Donell 0457f64
===================================================================
Carlos O'Donell 0457f64
--- glibc-2.22-193-g315267a.orig/posix/bug-regex17.c
Carlos O'Donell 0457f64
+++ glibc-2.22-193-g315267a/posix/bug-regex17.c
Carlos O'Donell 0457f64
@@ -23,6 +23,7 @@
Carlos O'Donell 0457f64
 #include <stdio.h>
Carlos O'Donell 0457f64
 #include <stdlib.h>
Carlos O'Donell 0457f64
 #include <locale.h>
Carlos O'Donell 0457f64
+#include <libc-internal.h>
Carlos O'Donell 0457f64
 
Carlos O'Donell 0457f64
 /* Tests supposed to match.  */
Carlos O'Donell 0457f64
 struct
Carlos O'Donell 0457f64
@@ -87,6 +88,14 @@ do_test (void)
Carlos O'Donell 0457f64
 	  continue;
Carlos O'Donell 0457f64
 	}
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 entirely possible since n is limited to
Carlos O'Donell 0457f64
+	 static nmatch which is limited to at most 5 (see tests above).
Carlos O'Donell 0457f64
+	 This is likely PR/59124 which is still not fixed.  */
Carlos O'Donell 0457f64
+      DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
Carlos O'Donell 0457f64
+#endif
Carlos O'Donell 0457f64
       for (n = 0; n < tests[i].nmatch; ++n)
Carlos O'Donell 0457f64
 	if (rm[n].rm_so != tests[i].rm[n].rm_so
Carlos O'Donell 0457f64
               || rm[n].rm_eo != tests[i].rm[n].rm_eo)
Carlos O'Donell 0457f64
@@ -98,6 +107,7 @@ do_test (void)
Carlos O'Donell 0457f64
 	    ret = 1;
Carlos O'Donell 0457f64
 	    break;
Carlos O'Donell 0457f64
 	  }
Carlos O'Donell 0457f64
+      DIAG_POP_NEEDS_COMMENT
Carlos O'Donell 0457f64
 
Carlos O'Donell 0457f64
       regfree (&re);
Carlos O'Donell 0457f64
     }
Carlos O'Donell 0457f64
Index: glibc-2.22-193-g315267a/posix/bug-regex18.c
Carlos O'Donell 0457f64
===================================================================
Carlos O'Donell 0457f64
--- glibc-2.22-193-g315267a.orig/posix/bug-regex18.c
Carlos O'Donell 0457f64
+++ glibc-2.22-193-g315267a/posix/bug-regex18.c
Carlos O'Donell 0457f64
@@ -23,6 +23,7 @@
Carlos O'Donell 0457f64
 #include <stdio.h>
Carlos O'Donell 0457f64
 #include <stdlib.h>
Carlos O'Donell 0457f64
 #include <locale.h>
Carlos O'Donell 0457f64
+#include <libc-internal.h>
Carlos O'Donell 0457f64
 
Carlos O'Donell 0457f64
 /* Tests supposed to match.  */
Carlos O'Donell 0457f64
 struct
Carlos O'Donell 0457f64
@@ -80,6 +81,14 @@ main (void)
Carlos O'Donell 0457f64
 	  continue;
Carlos O'Donell 0457f64
 	}
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 entirely possible since n is limited to
Carlos O'Donell 0457f64
+	 static nmatch which is limited to at most 5 (see tests above).
Carlos O'Donell 0457f64
+	 This is likely PR/59124 which is still not fixed.  */
Carlos O'Donell 0457f64
+      DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
Carlos O'Donell 0457f64
+#endif
Carlos O'Donell 0457f64
       for (n = 0; n < tests[i].nmatch; ++n)
Carlos O'Donell 0457f64
 	if (rm[n].rm_so != tests[i].rm[n].rm_so
Carlos O'Donell 0457f64
               || rm[n].rm_eo != tests[i].rm[n].rm_eo)
Carlos O'Donell 0457f64
@@ -91,6 +100,7 @@ main (void)
Carlos O'Donell 0457f64
 	    ret = 1;
Carlos O'Donell 0457f64
 	    break;
Carlos O'Donell 0457f64
 	  }
Carlos O'Donell 0457f64
+      DIAG_POP_NEEDS_COMMENT
Carlos O'Donell 0457f64
 
Carlos O'Donell 0457f64
       regfree (&re);
Carlos O'Donell 0457f64
     }
Carlos O'Donell 0457f64
Index: glibc-2.22-193-g315267a/posix/bug-regex30.c
Carlos O'Donell 0457f64
===================================================================
Carlos O'Donell 0457f64
--- glibc-2.22-193-g315267a.orig/posix/bug-regex30.c
Carlos O'Donell 0457f64
+++ glibc-2.22-193-g315267a/posix/bug-regex30.c
Carlos O'Donell 0457f64
@@ -23,6 +23,7 @@
Carlos O'Donell 0457f64
 #include <stdio.h>
Carlos O'Donell 0457f64
 #include <stdlib.h>
Carlos O'Donell 0457f64
 #include <locale.h>
Carlos O'Donell 0457f64
+#include <libc-internal.h>
Carlos O'Donell 0457f64
 
Carlos O'Donell 0457f64
 /* Tests supposed to match.  */
Carlos O'Donell 0457f64
 struct
Carlos O'Donell 0457f64
@@ -80,6 +81,14 @@ do_test (void)
Carlos O'Donell 0457f64
 	  continue;
Carlos O'Donell 0457f64
 	}
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 entirely possible since n is limited to
Carlos O'Donell 0457f64
+	 static nmatch which is limited to at most 5 (see tests above).
Carlos O'Donell 0457f64
+	 This is likely PR/59124 which is still not fixed.  */
Carlos O'Donell 0457f64
+      DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
Carlos O'Donell 0457f64
+#endif
Carlos O'Donell 0457f64
       for (n = 0; n < tests[i].nmatch; ++n)
Carlos O'Donell 0457f64
 	if (rm[n].rm_so != tests[i].rm[n].rm_so
Carlos O'Donell 0457f64
 	      || rm[n].rm_eo != tests[i].rm[n].rm_eo)
Carlos O'Donell 0457f64
@@ -91,6 +100,7 @@ do_test (void)
Carlos O'Donell 0457f64
 	    ret = 1;
Carlos O'Donell 0457f64
 	    break;
Carlos O'Donell 0457f64
 	  }
Carlos O'Donell 0457f64
+      DIAG_POP_NEEDS_COMMENT
Carlos O'Donell 0457f64
 
Carlos O'Donell 0457f64
       regfree (&re);
Carlos O'Donell 0457f64
     }