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