On Wed, May 27, 2026 at 5:51 AM Daniel Barboza
<[email protected]> wrote:
>
> We're no longer issuing Wstrict-overflow warnings, even with the
> -Wstrict-overflow flag being used.
>
> Remove the tests that are still testing for it.  They're either compile
> tests that are testing cases where a warning shouldn't be issued or
> XFAIL tests.
>
> gcc/testsuite/ChangeLog:
>
>         * gcc.dg/Wstrict-overflow-10.c: Removed.
>         * gcc.dg/Wstrict-overflow-11.c: Removed.
>         * gcc.dg/Wstrict-overflow-12.c: Removed.
>         * gcc.dg/Wstrict-overflow-13.c: Removed.
>         * gcc.dg/Wstrict-overflow-14.c: Removed.
>         * gcc.dg/Wstrict-overflow-15.c: Removed.
>         * gcc.dg/Wstrict-overflow-16.c: Removed.
>         * gcc.dg/Wstrict-overflow-17.c: Removed.
>         * gcc.dg/Wstrict-overflow-18.c: Removed.
>         * gcc.dg/Wstrict-overflow-19.c: Removed.
>         * gcc.dg/Wstrict-overflow-2.c: Removed.
>         * gcc.dg/Wstrict-overflow-20.c: Removed.
>         * gcc.dg/Wstrict-overflow-21.c: Removed.
>         * gcc.dg/Wstrict-overflow-23.c: Removed.
>         * gcc.dg/Wstrict-overflow-26.c: Removed.
>         * gcc.dg/Wstrict-overflow-27.c: Removed.
>         * gcc.dg/Wstrict-overflow-4.c: Removed.
>         * gcc.dg/Wstrict-overflow-6.c: Removed.
>         * gcc.dg/Wstrict-overflow-7.c: Removed.
>         * gcc.dg/Wstrict-overflow-8.c: Removed.

Ok.

> ---
>  gcc/testsuite/gcc.dg/Wstrict-overflow-10.c | 10 -------
>  gcc/testsuite/gcc.dg/Wstrict-overflow-11.c | 19 -------------
>  gcc/testsuite/gcc.dg/Wstrict-overflow-12.c | 16 -----------
>  gcc/testsuite/gcc.dg/Wstrict-overflow-13.c | 18 -------------
>  gcc/testsuite/gcc.dg/Wstrict-overflow-14.c | 15 -----------
>  gcc/testsuite/gcc.dg/Wstrict-overflow-15.c | 15 -----------
>  gcc/testsuite/gcc.dg/Wstrict-overflow-16.c | 11 --------
>  gcc/testsuite/gcc.dg/Wstrict-overflow-17.c | 20 --------------
>  gcc/testsuite/gcc.dg/Wstrict-overflow-18.c | 23 ----------------
>  gcc/testsuite/gcc.dg/Wstrict-overflow-19.c | 15 -----------
>  gcc/testsuite/gcc.dg/Wstrict-overflow-2.c  | 13 ---------
>  gcc/testsuite/gcc.dg/Wstrict-overflow-20.c | 15 -----------
>  gcc/testsuite/gcc.dg/Wstrict-overflow-21.c | 12 ---------
>  gcc/testsuite/gcc.dg/Wstrict-overflow-23.c | 31 ----------------------
>  gcc/testsuite/gcc.dg/Wstrict-overflow-26.c | 16 -----------
>  gcc/testsuite/gcc.dg/Wstrict-overflow-27.c | 28 -------------------
>  gcc/testsuite/gcc.dg/Wstrict-overflow-4.c  | 13 ---------
>  gcc/testsuite/gcc.dg/Wstrict-overflow-6.c  | 13 ---------
>  gcc/testsuite/gcc.dg/Wstrict-overflow-7.c  | 10 -------
>  gcc/testsuite/gcc.dg/Wstrict-overflow-8.c  | 10 -------
>  20 files changed, 323 deletions(-)
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-10.c
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-11.c
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-12.c
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-13.c
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-14.c
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-15.c
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-16.c
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-17.c
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-18.c
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-19.c
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-2.c
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-20.c
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-21.c
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-23.c
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-26.c
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-27.c
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-4.c
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-6.c
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-7.c
>  delete mode 100644 gcc/testsuite/gcc.dg/Wstrict-overflow-8.c
>
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-10.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-10.c
> deleted file mode 100644
> index d2c259728cb..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-10.c
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow=1" } */
> -
> -/* Source: Ian Lance Taylor.  */
> -
> -int
> -foo (int i)
> -{
> -  return __builtin_abs (i) >= 0;
> -}
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-11.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-11.c
> deleted file mode 100644
> index 3caf1cb6f09..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-11.c
> +++ /dev/null
> @@ -1,19 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow=1" } */
> -
> -/* Based on strict-overflow-5.c.  */
> -
> -/* We can only unroll when using strict overflow semantics.  But we
> -   don't issue a warning for relying on undefined overflow in
> -   loops.  */
> -
> -int foo (int i)
> -{
> -  int index;
> -  int r=0;
> -
> -  for (index = i; index <= i+4; index+=2)
> -    r++;
> -
> -  return r;
> -}
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-12.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-12.c
> deleted file mode 100644
> index 2837ce3a44e..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-12.c
> +++ /dev/null
> @@ -1,16 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow=2" } */
> -
> -/* Source: Ian Lance Taylor.  Dual of no-strict-overflow-6.c.  */
> -
> -/* VRP test.  This turns into an infinite loop when using strict
> -   overflow semantics.  */
> -
> -int
> -foo ()
> -{
> -  int i, bits;
> -  for (i = 1, bits = 1; i > 0; i += i) /* { dg-warning "assuming signed 
> overflow does not occur" "correct warning" { xfail *-*-* } } */
> -    ++bits;
> -  return bits;
> -}
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-13.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-13.c
> deleted file mode 100644
> index 8691cd82fe4..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-13.c
> +++ /dev/null
> @@ -1,18 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow=2" } */
> -
> -/* Source: Ian Lance Taylor.  Dual of no-strict-overflow-6.c.  */
> -
> -/* VRP test.  This turns into an infinite loop (depending on what
> -   bigtime_test does), but at least we warn about it.  */
> -
> -extern int bigtime_test (int);
> -int
> -foo ()
> -{
> -  int j;
> -  for (j = 1; 0 < j; j *= 2) /* { dg-warning "assuming signed overflow does 
> not occur" "correct warning" { xfail *-*-* } } */
> -    if (! bigtime_test (j))
> -      return 1;
> -  return 0;
> -}
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-14.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-14.c
> deleted file mode 100644
> index dda07ea733b..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-14.c
> +++ /dev/null
> @@ -1,15 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow=4" } */
> -
> -/* Source: Ian Lance Taylor.  */
> -
> -int
> -foo (int j)
> -{
> -  int i;
> -  int sum = 0;
> -
> -  for (i = 1; i < j; i += i)
> -    sum += i / 16; /* { dg-warning "assuming signed overflow does not occur" 
> ""  { xfail *-*-* } } */
> -  return sum;
> -}
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-15.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-15.c
> deleted file mode 100644
> index c9e275c0bd6..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-15.c
> +++ /dev/null
> @@ -1,15 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow=4" } */
> -
> -/* Source: Ian Lance Taylor.  */
> -
> -int
> -foo (int j)
> -{
> -  int i;
> -  int sum = 0;
> -
> -  for (i = 1; i < j; i += i)
> -    sum += __builtin_abs (i); /* { dg-warning "assuming signed overflow does 
> not occur" "" { xfail *-*-* } } */
> -  return sum;
> -}
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-16.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-16.c
> deleted file mode 100644
> index e8c31cf5046..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-16.c
> +++ /dev/null
> @@ -1,11 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow" } */
> -
> -/* From PR 31522.  */
> -
> -int f (int x) {
> -  int y;
> -  if (x <= 4) y = 1;
> -  else y = x / 4;
> -  return y <= 0;
> -}
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-17.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-17.c
> deleted file mode 100644
> index 5625bc2a7f3..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-17.c
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow" } */
> -
> -/* This erroneously gave an overflow warning.  */
> -
> -extern void bar (char);
> -void
> -foo (char *s)
> -{
> -  int len, i;
> -
> -  for (len = 1; len < 5000; ++len)
> -    {
> -      for (i = 0; i < len; ++i)
> -       {
> -         if (s[i] != '\0')
> -           bar (s[i]);
> -       }
> -    }
> -}
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-18.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-18.c
> deleted file mode 100644
> index 8c8ddcf2b26..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-18.c
> +++ /dev/null
> @@ -1,23 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow" } */
> -
> -/* Warn about an overflow when folding i > 0, p->a - p->b can be larger
> -   than INT_MAX and thus i can wrap.  */
> -
> -struct c { unsigned int a; unsigned int b; };
> -extern void bar (struct c *);
> -int
> -foo (struct c *p)
> -{
> -  int i;
> -  int sum = 0;
> -
> -  for (i = 0; i < p->a - p->b; ++i)
> -    {
> -      /* See PR80511 for the XFAIL.  */
> -      if (i > 0)  /* { dg-warning "signed overflow" "" { xfail *-*-* } } */
> -       sum += 2;
> -      bar (p);
> -    }
> -  return sum;
> -}
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-19.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-19.c
> deleted file mode 100644
> index daf98b0ce63..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-19.c
> +++ /dev/null
> @@ -1,15 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow" } */
> -
> -/* Don't warn about an overflow when threading jumps.  We used to get
> -   a warning from comparing bounds generated by VRP.  */
> -
> -int
> -bar(int a, int b, int n)
> -{
> -  if (b > a)
> -    n = a - b;
> -  if (a >= b)
> -    n = 1;
> -  return n;
> -}
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-2.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-2.c
> deleted file mode 100644
> index 2112571cabe..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-2.c
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow=2" } */
> -
> -/* Source: Ian Lance Taylor.  Based on strict-overflow-1.c.  */
> -
> -/* We can only simplify the conditional when using strict overflow
> -   semantics.  */
> -
> -int
> -foo (int i)
> -{
> -  return i - 5 < 10;
> -}
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-20.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-20.c
> deleted file mode 100644
> index 260d20c9c9c..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-20.c
> +++ /dev/null
> @@ -1,15 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-std=gnu17 -fstrict-overflow -O2 -Wstrict-overflow" } */
> -
> -/* Don't warn about an overflow in a copied loop header.  We used to
> -   get a warning in value numbering.  This is PR 33565.  */
> -
> -void do_something ();
> -
> -void f (int m, int n)
> -{
> -  int j;
> -
> -  for (j = m; j        < m + 10 && j < n; j ++)
> -    do_something (j);
> -}
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-21.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-21.c
> deleted file mode 100644
> index 82a61d966f3..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-21.c
> +++ /dev/null
> @@ -1,12 +0,0 @@
> -/* PR 32102: -Wall stomps on -Wstrict-overflow */
> -/* { dg-do compile } */
> -/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow=2 -Wall" } */
> -int
> -foo ()
> -{
> -  int i, bits;
> -  for (i = 1, bits = 1; i > 0; i += i) /* { dg-warning "assuming signed 
> overflow does not occur" "correct warning" { xfail *-*-* } } */
> -    ++bits;
> -  return bits;
> -}
> -
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-23.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-23.c
> deleted file mode 100644
> index 16014bb15c5..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-23.c
> +++ /dev/null
> @@ -1,31 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-O2 -Wstrict-overflow" } */
> -
> -unsigned int
> -do_scrolling (unsigned int window_size, unsigned int writecost)
> -{
> -  unsigned int i = window_size;
> -
> -  int terminal_window_p = 0;
> -  unsigned int queue = 0;
> -
> -  for (i = window_size; i; i--)
> -    {
> -      if (writecost < i)
> -    ++queue;
> -      else if (writecost & 1)
> -    terminal_window_p = 1;
> -    }
> -
> -  if (queue > 0)
> -    {
> -      if (!terminal_window_p)
> -    {
> -      terminal_window_p = 1;
> -    }
> -    }
> -
> -  if (terminal_window_p)
> -    return 100;
> -  return 0;
> -}
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-26.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-26.c
> deleted file mode 100644
> index ef805b56d25..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-26.c
> +++ /dev/null
> @@ -1,16 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-O2 -Wstrict-overflow" } */
> -
> -int
> -f (int i, int j)
> -{
> -  unsigned int c = 0;
> -  if (i < j)
> -    {
> -      unsigned int n = j - i;
> -      unsigned int i;
> -      for (i = 0; i < n; i++) /* { dg-bogus "signed overflow" } */
> -       c++;
> -    }
> -  return c;
> -}
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-27.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-27.c
> deleted file mode 100644
> index 95d101ad02e..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-27.c
> +++ /dev/null
> @@ -1,28 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-O3 -Wstrict-overflow=2 -Werror" } */
> -
> -typedef __SIZE_TYPE__ size_t;
> -extern char *strtok_r (char *__restrict __s, const char *__restrict __delim,
> -                      char **__restrict __save_ptr)
> -  __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 
> 3)));
> -extern const unsigned short int **__ctype_b_loc (void)
> -  __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
> -extern int *DEBUGLEVEL_CLASS;
> -size_t debug_num_classes = 0;
> -void debug_parse_param(char *param);
> -void
> -debug_parse_levels(const char *params_str, size_t str_len)
> -{
> -  char str[str_len+1];
> -  char *tok, *saveptr;
> -  size_t i;
> -  tok = strtok_r(str, " \t,\n\r", &saveptr);
> -  if (((*__ctype_b_loc ())[(int) ((tok[0]))]))
> -    tok = strtok_r(((void *)0), " \t,\n\r", &saveptr);
> -  else
> -    DEBUGLEVEL_CLASS[0] = 0;
> -  for (i = 0 +1; i < debug_num_classes; i++)
> -    DEBUGLEVEL_CLASS[i] = DEBUGLEVEL_CLASS[0];
> -  while (tok != ((void *)0) )
> -    debug_parse_param(tok);
> -}
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-4.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-4.c
> deleted file mode 100644
> index e880bef45ff..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-4.c
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow=3" } */
> -
> -/* Source: Ian Lance Taylor.  Based on strict-overflow-2.c.  */
> -
> -/* We can only simplify the division when using strict overflow
> -   semantics.  */
> -
> -int
> -foo (int i)
> -{
> -  return (i * 100) / 10;
> -}
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-6.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-6.c
> deleted file mode 100644
> index c3a160c6002..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-6.c
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow=2" } */
> -
> -/* Source: Ian Lance Taylor.  Based on strict-overflow-3.c.  */
> -
> -/* We can only simplify the conditional when using strict overflow
> -   semantics.  */
> -
> -int
> -foo (int i, int j)
> -{
> -  return i + 100 < j + 1000;
> -}
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-7.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-7.c
> deleted file mode 100644
> index 401cbc3c987..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-7.c
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow" } */
> -
> -/* Source: Ian Lance Taylor.  */
> -
> -int
> -foo (int i)
> -{
> -  return i + 10 > i; /* { dg-warning "assuming signed overflow does not 
> occur" "correct warning" { xfail *-*-* } } */
> -}
> diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-8.c 
> b/gcc/testsuite/gcc.dg/Wstrict-overflow-8.c
> deleted file mode 100644
> index 566729fe308..00000000000
> --- a/gcc/testsuite/gcc.dg/Wstrict-overflow-8.c
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-fstrict-overflow -O2 -Wall -Wno-strict-overflow" } */
> -
> -/* Source: Ian Lance Taylor.  */
> -
> -int
> -foo (int i)
> -{
> -  return i + 10 > i;
> -}
> --
> 2.43.0
>

Reply via email to