On Wed, May 27, 2026 at 5:51 AM Daniel Barboza
<[email protected]> wrote:
>
> 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.
Ok.
> ---
> gcc/testsuite/gcc.dg/pr36227.c | 14 --------------
> gcc/testsuite/gcc.dg/pr48022-1.c | 14 --------------
> gcc/testsuite/gcc.dg/pr48022-2.c | 11 -----------
> gcc/testsuite/gcc.dg/pr49705.c | 19 -------------------
> gcc/testsuite/gcc.dg/pr52904.c | 20 --------------------
> gcc/testsuite/gcc.dg/pr81592.c | 2 +-
> gcc/testsuite/gcc.dg/pragma-diag-3.c | 19 ++-----------------
> 7 files changed, 3 insertions(+), 96 deletions(-)
> delete mode 100644 gcc/testsuite/gcc.dg/pr36227.c
> delete mode 100644 gcc/testsuite/gcc.dg/pr48022-1.c
> delete mode 100644 gcc/testsuite/gcc.dg/pr48022-2.c
> delete mode 100644 gcc/testsuite/gcc.dg/pr49705.c
> delete mode 100644 gcc/testsuite/gcc.dg/pr52904.c
>
> diff --git a/gcc/testsuite/gcc.dg/pr36227.c b/gcc/testsuite/gcc.dg/pr36227.c
> deleted file mode 100644
> index ba0d7224939..00000000000
> --- a/gcc/testsuite/gcc.dg/pr36227.c
> +++ /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
> index 14eb550307c..00000000000
> --- a/gcc/testsuite/gcc.dg/pr48022-1.c
> +++ /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
> index 41fcb533819..00000000000
> --- a/gcc/testsuite/gcc.dg/pr48022-2.c
> +++ /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
> index 0c326ae3f71..00000000000
> --- a/gcc/testsuite/gcc.dg/pr49705.c
> +++ /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
> index 0b8910fbe18..00000000000
> --- a/gcc/testsuite/gcc.dg/pr52904.c
> +++ /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;
> -}
> diff --git a/gcc/testsuite/gcc.dg/pr81592.c b/gcc/testsuite/gcc.dg/pr81592.c
> index a37703af497..3abe96a47ec 100644
> --- a/gcc/testsuite/gcc.dg/pr81592.c
> +++ b/gcc/testsuite/gcc.dg/pr81592.c
> @@ -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>
>
> diff --git a/gcc/testsuite/gcc.dg/pragma-diag-3.c
> b/gcc/testsuite/gcc.dg/pragma-diag-3.c
> index b6ee60f1677..e01bab83d77 100644
> --- a/gcc/testsuite/gcc.dg/pragma-diag-3.c
> +++ b/gcc/testsuite/gcc.dg/pragma-diag-3.c
> @@ -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;
> --
> 2.43.0
>