diff mbox series

Verify range and pt_solution pointers

Message ID 2d2e624c-ee65-49dc-bc5a-3a738f013358@redhat.com
State New
Headers show
Series Verify range and pt_solution pointers | expand

Commit Message

Andrew MacLeod Nov. 3, 2026, 4:14 p.m. UTC
verify_ssa should check the range for prange as well now in addition to the pt_solution field.  Turns out frange wasn't being verified either.

Bootstraps on  x86_64-pc-linux-gnu with no regressions.  OK for trunk?

Andrew
------------------------



The current ssa-name verifier is not checking frange nor prange, and
can now verify pt_solution seperately.

	* tree-ssa.cc (verify_ssa): Verify ranges and pt_solution.
---
 gcc/tree-ssa.cc | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

Comments

Richard Biener Nov. 4, 2026, 8:03 a.m. UTC | #1
On Tue, Nov 3, 2026 at 5:15 PM Andrew MacLeod <amacleod@redhat.com> wrote:
>
> verify_ssa should check the range for prange as well now in addition to the pt_solution field.  Turns out frange wasn't being verified either.
>
> Bootstraps on  x86_64-pc-linux-gnu with no regressions.  OK for trunk?

OK.

> Andrew
> ------------------------
>
>
>
> The current ssa-name verifier is not checking frange nor prange, and
> can now verify pt_solution seperately.
>
>         * tree-ssa.cc (verify_ssa): Verify ranges and pt_solution.
> ---
>  gcc/tree-ssa.cc | 23 ++++++++++++++++++-----
>  1 file changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/gcc/tree-ssa.cc b/gcc/tree-ssa.cc
> index 1be5290c85f..e1c15283e5c 100644
> --- a/gcc/tree-ssa.cc
> +++ b/gcc/tree-ssa.cc
> @@ -1093,11 +1093,24 @@ verify_ssa (bool check_modified_stmt, bool check_ssa_operands)
>                 goto err;
>             }
>
> -         const void *info = NULL;
> -         if (POINTER_TYPE_P (TREE_TYPE (name)))
> -           info = ssa_name_pt_solution (name);
> -         else if (INTEGRAL_TYPE_P (TREE_TYPE (name)))
> -           info = SSA_NAME_RANGE_INFO (name);
> +         const pt_solution *pt_info = ssa_name_pt_solution (name);
> +         if (pt_info)
> +           {
> +             bool existed;
> +             tree &val = ssa_info.get_or_insert (pt_info, &existed);
> +             if (existed)
> +               {
> +                 error ("shared SSA name pt_solution info");
> +                 print_generic_expr (stderr, val);
> +                 fprintf (stderr, " and ");
> +                 print_generic_expr (stderr, name);
> +                 fprintf (stderr, "\n");
> +                 goto err;
> +               }
> +             else
> +               val = name;
> +           }
> +         const void *info = SSA_NAME_RANGE_INFO (name);
>           if (info)
>             {
>               bool existed;
> --
> 2.56.0
>
diff mbox series

Patch

diff --git a/gcc/tree-ssa.cc b/gcc/tree-ssa.cc
index 1be5290c85f..e1c15283e5c 100644
--- a/gcc/tree-ssa.cc
+++ b/gcc/tree-ssa.cc
@@ -1093,11 +1093,24 @@  verify_ssa (bool check_modified_stmt, bool check_ssa_operands)
 		goto err;
 	    }
 
-	  const void *info = NULL;
-	  if (POINTER_TYPE_P (TREE_TYPE (name)))
-	    info = ssa_name_pt_solution (name);
-	  else if (INTEGRAL_TYPE_P (TREE_TYPE (name)))
-	    info = SSA_NAME_RANGE_INFO (name);
+	  const pt_solution *pt_info = ssa_name_pt_solution (name);
+	  if (pt_info)
+	    {
+	      bool existed;
+	      tree &val = ssa_info.get_or_insert (pt_info, &existed);
+	      if (existed)
+		{
+		  error ("shared SSA name pt_solution info");
+		  print_generic_expr (stderr, val);
+		  fprintf (stderr, " and ");
+		  print_generic_expr (stderr, name);
+		  fprintf (stderr, "\n");
+		  goto err;
+		}
+	      else
+		val = name;
+	    }
+	  const void *info = SSA_NAME_RANGE_INFO (name);
 	  if (info)
 	    {
 	      bool existed;