]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: remove Wstrict-overflow related tests
authorDaniel Barboza <daniel.barboza@oss.qualcomm.com>
Tue, 26 May 2026 16:56:05 +0000 (13:56 -0300)
committerDaniel Barboza <daniel.barboza@oss.qualcomm.com>
Sun, 31 May 2026 18:51:45 +0000 (15:51 -0300)
The following testsuite PRs are related to the now obsolete
Wstrict-overflow option:

- Bug 36227 - [4.3 Regression] POINTER_PLUS folding introduces undefined
  overflow
- Bug 48022 - [4.6 Regression] -Wstrict-overflow warning on code that
  doesn't have overflows
- Bug 49705 - -Wstrict-overflow should not diagnose unevaluated
  expressions
- Bug 52904 - -Wstrict-overflow false alarm with bounded loop

They are exercising code that no longer exists, so remove all of them.
Two other tests (pr81592.c and pragma-diag-3.c) have Wstrict-overflow
checks that got removed.

gcc/testsuite/ChangeLog:

* gcc.dg/pr81592.c: Removed strict-overflow options.
* gcc.dg/pragma-diag-3.c: Removed Wstrict-overflow option, along
with a reference and tests for PR66098 ("[5 regression] #pragma
diagnostic 'ignored' not fullyundone by pop for
strict-overflow").
* gcc.dg/pr36227.c: Removed.
* gcc.dg/pr48022-1.c: Removed.
* gcc.dg/pr48022-2.c: Removed.
* gcc.dg/pr49705.c: Removed.
* gcc.dg/pr52904.c: Removed.

gcc/testsuite/gcc.dg/pr36227.c [deleted file]
gcc/testsuite/gcc.dg/pr48022-1.c [deleted file]
gcc/testsuite/gcc.dg/pr48022-2.c [deleted file]
gcc/testsuite/gcc.dg/pr49705.c [deleted file]
gcc/testsuite/gcc.dg/pr52904.c [deleted file]
gcc/testsuite/gcc.dg/pr81592.c
gcc/testsuite/gcc.dg/pragma-diag-3.c

diff --git a/gcc/testsuite/gcc.dg/pr36227.c b/gcc/testsuite/gcc.dg/pr36227.c
deleted file mode 100644 (file)
index ba0d722..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2 -Wstrict-overflow=3" } */
-typedef __UINTPTR_TYPE__ ptrcast;
-
-volatile unsigned long *
-sat_add(volatile unsigned long *ptr, unsigned long i, volatile unsigned long *end)
-{
-  if ((ptrcast)ptr + i * sizeof(*ptr) > (ptrcast)ptr) /* { dg-bogus "pointer wraparound" } */
-    return ptr + i;
-  else
-    return end;
-}
-
-
diff --git a/gcc/testsuite/gcc.dg/pr48022-1.c b/gcc/testsuite/gcc.dg/pr48022-1.c
deleted file mode 100644 (file)
index 14eb550..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/* PR tree-optimization/48022 */
-/* { dg-do compile } */
-/* { dg-options "-O2 -Wstrict-overflow" } */
-
-int
-foo (const char *x)
-{
-  unsigned long l = 1;
-  const unsigned char *s = (const unsigned char *) (const char *) (x);
-  int r = s[0] - ((const unsigned char *) (const char *) ("/"))[0];
-  if (l > 0 && r == 0)
-    r = (s[1] - ((const unsigned char *) (const char *) ("/"))[1]);
-  return r;
-}
diff --git a/gcc/testsuite/gcc.dg/pr48022-2.c b/gcc/testsuite/gcc.dg/pr48022-2.c
deleted file mode 100644 (file)
index 41fcb53..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/* PR tree-optimization/48022 */
-/* { dg-do compile } */
-/* { dg-options "-O2 -Wstrict-overflow" } */
-
-#include <string.h>
-
-int
-foo (const char *x)
-{
-  return strcmp (x, "/");
-}
diff --git a/gcc/testsuite/gcc.dg/pr49705.c b/gcc/testsuite/gcc.dg/pr49705.c
deleted file mode 100644 (file)
index 0c326ae..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2 -Wstrict-overflow" } */
-
-struct glyph
-{
-  long foo, bar, baz;
-};
-
-extern int fatal (char const *, int, int);
-
-int
-check_image_width (int width, int height)
-{
-  if ((((((0 * (0 * 2 + width) - 1) < 0) ? - (~ (0 * (0 * 2 + width) + 0) == -1) - ((((0 * (0 * 2 + width) + 1) << (sizeof ((0 * 2 + width) + 0) * 8 - 2)) - 1) * 2 + 1) : (0 * (0 * 2 + width) + 0))) < 0 ? (2 < 0 ? width < ((((0 * (0 * 2 + width) - 1) < 0) ? - (~ (0 * (0 * 2 + width) + 0) == -1) - ((((0 * (0 * 2 + width) + 1) << (sizeof ((0 * 2 + width) + 0) * 8 - 2)) - 1) * 2 + 1) : (0 * (0 * 2 + width) + 0))) - 2 : ((((0 * (0 * 2 + width) - 1) < 0) ? ((((0 * (0 * 2 + width) + 1) << (sizeof ((0 * 2 + width) + 0) * 8 - 2)) - 1) * 2 + 1) : (0 * (0 * 2 + width) - 1))) - 2 < width) : width < 0 ? 2 <= width + 2 : 2 < 0 ? width <= width + 2 : width + 2 < 2)
-      || ((((((0 * (0 * height + (width + 2)) - 1) < 0) ? - (~ (0 * (0 * height + (width + 2)) + 0) == -1) - ((((0 * (0 * height + (width + 2)) + 1) << (sizeof ((0 * height + (width + 2)) + 0) * 8 - 2)) - 1) * 2 + 1) : (0 * (0 * height + (width + 2)) + 0))) == 0 && (((width + 2) < 0 && 0 < height) || (height < 0 && 0 < (width + 2)))) || (height < 0 ? ((width + 2) < 0 ? (width + 2) < ((((0 * (0 * height + (width + 2)) - 1) < 0) ? ((((0 * (0 * height + (width + 2)) + 1) << (sizeof ((0 * height + (width + 2)) + 0) * 8 - 2)) - 1) * 2 + 1) : (0 * (0 * height + (width + 2)) - 1))) / height : height == -1 ? 0 : ((((0 * (0 * height + (width + 2)) - 1) < 0) ? - (~ (0 * (0 * height + (width + 2)) + 0) == -1) - ((((0 * (0 * height + (width + 2)) + 1) << (sizeof ((0 * height + (width + 2)) + 0) * 8 - 2)) - 1) * 2 + 1) : (0 * (0 * height + (width + 2)) + 0))) / height < (width + 2)) : height == 0 ? 0 : ((width + 2) < 0 ? (width + 2) < ((((0 * (0 * height + (width + 2)) - 1) < 0) ? - (~ (0 * (0 * height + (width + 2)) + 0) == -1) - ((((0 * (0 * height + (width + 2)) + 1) << (sizeof ((0 * height + (width + 2)) + 0) * 8 - 2)) - 1) * 2 + 1) : (0 * (0 * height + (width + 2)) + 0))) / height : ((((0 * (0 * height + (width + 2)) - 1) < 0) ? ((((0 * (0 * height + (width + 2)) + 1) << (sizeof ((0 * height + (width + 2)) + 0) * 8 - 2)) - 1) * 2 + 1) : (0 * (0 * height + (width + 2)) - 1))) / height < (width + 2))))
-      || ((9223372036854775807L < 18446744073709551615UL ? 9223372036854775807L : 18446744073709551615UL) / sizeof (struct glyph)
-         < (width + 2) * height))
-    fatal ("screen size %dx%d too big", width, height);
-}
diff --git a/gcc/testsuite/gcc.dg/pr52904.c b/gcc/testsuite/gcc.dg/pr52904.c
deleted file mode 100644 (file)
index 0b8910f..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-Wstrict-overflow -O2" } */
-extern int foo (int);
-
-int
-wait_reading_process_output (void)
-{
-  int nfds = 0;
-  int channel;
-
-  for (channel = 0; channel < 1024; ++channel)
-    {
-      if (foo (channel))
-       nfds++;
-    }
-
-  if (nfds < 0) /* { dg-bogus "assuming signed overflow does not occur" "" } */
-    return 1;
-  return 0;
-}
index a37703af4970216c00219dbdf8a25638af6839c5..3abe96a47ec42c7b35949eb6d33bc42026872a03 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -Wall -fno-strict-overflow  -Wstrict-overflow=2 -fsanitize=signed-integer-overflow" } */
+/* { dg-options "-O2 -Wall -fsanitize=signed-integer-overflow" } */
 
 #include <stdio.h>
 
index b6ee60f16770924a1e882f10b0c9376ff040c568..e01bab83d777534eb450bab345d2b19e1c498c69 100644 (file)
@@ -1,23 +1,8 @@
 /* { dg-do compile } */
-/* { dg-options "-Wswitch-enum -Wsign-compare -fstrict-overflow -Wstrict-overflow -Werror -Wno-error=switch-enum" } */
-/* PR c/66098 - #pragma diagnostic 'ignored' not fully undone by pop for strict-overflow 
-   PR c/66711 - GCC does not correctly restore diagnostic state after pragma GCC diagnostic pop with -Werror 
-*/
+/* { dg-options "-Wswitch-enum -Wsign-compare -fstrict-overflow -Werror -Wno-error=switch-enum" } */
 /* { dg-message "warnings being treated as errors" "" {target "*-*-*"} 0 } */
 
-void testing2() {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wstrict-overflow"
-  int j = 4;
-  j + 4 < j;
-#pragma GCC diagnostic pop
-}
-
-void testing3() {
-  int k = 4;
-  k + 4 < k; /* { dg-error "overflow" "" { xfail *-*-* } } */
-}
-
+/* PR c/66711 - GCC does not correctly restore diagnostic state after pragma GCC diagnostic pop with -Werror  */
 int bar()
 {
   unsigned x = 0;