Hi,
I cvise'd the reproducer from the PR, would this be acceptable as a
testcase? Not sure if it's placed correctly.
Thanks,
Josef
On 2/5/26 1:58 PM, Richard Biener wrote:
The following makes sure to release any SLP kind specific data when
rolling back earlier successful analysis. This avoids crashing
when re-analyzing such node via another graph entry.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
The testcase was on the big side, so not included.
Richard.
PR tree-optimization/123986
* tree-vect-slp.cc (vect_slp_analyze_operations): When
rolling back analyzed nodes, release node specific data
and reset SLP_TREE_TYPE.
---
gcc/tree-vect-slp.cc | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index c481efc749f..c932e8d5cba 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -9258,10 +9258,19 @@ vect_slp_analyze_operations (vec_info *vinfo)
dump_printf_loc (MSG_NOTE, vect_location,
"removing SLP instance operations starting from:
%G",
stmt_info->stmt);
+ while (!visited_vec.is_empty ())
+ {
+ slp_tree node = visited_vec.pop ();
+ SLP_TREE_TYPE (node) = undef_vec_info_type;
+ if (node->data)
+ {
+ delete node->data;
+ node->data = nullptr;
+ }
+ visited.remove (node);
+ }
vect_free_slp_instance (instance);
vinfo->slp_instances.ordered_remove (i);
- while (!visited_vec.is_empty ())
- visited.remove (visited_vec.pop ());
}
else
{
From fecd4a51a403e616e16049d47413814d94ee4e1f Mon Sep 17 00:00:00 2001
From: Josef Melcr <[email protected]>
Date: Thu, 5 Feb 2026 15:21:00 +0100
Subject: [PATCH] testsuite: Add testcase for PR123986
This patch add a missing testcase cvise-reduced
testcase for PR123986.
PR 123986
gcc/testsuite/ChangeLog:
* gfortran.dg/vect/pr123986.f90: New test.
Signed-off-by: Josef Melcr <[email protected]>
---
gcc/testsuite/gfortran.dg/vect/pr123986.f90 | 36 +++++++++++++++++++++
1 file changed, 36 insertions(+)
create mode 100644 gcc/testsuite/gfortran.dg/vect/pr123986.f90
diff --git a/gcc/testsuite/gfortran.dg/vect/pr123986.f90 b/gcc/testsuite/gfortran.dg/vect/pr123986.f90
new file mode 100644
index 00000000000..30583294d30
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/pr123986.f90
@@ -0,0 +1,36 @@
+! { dg-do compile }
+! { dg-options "-Ofast -march=x86-64-v4" }
+
+MODULE bulk_cloud_model_mod
+ INTEGER, PARAMETER :: wp = KIND(1.0D0)
+ INTEGER, PARAMETER :: nzt = 1
+ REAL, PARAMETER :: df_crit = 100.0E-6
+ TYPE cloud_coefficients
+ REAL(wp) a
+ REAL(wp) b
+ END TYPE
+ TYPE cloud_species_def
+ TYPE(cloud_coefficients) cloud
+ TYPE(cloud_coefficients) graupel
+ END TYPE
+ TYPE(cloud_species_def) cloud_species
+CONTAINS
+ SUBROUTINE riming_graupel_cloud
+ REAL(wp) dc
+ REAL(wp) dg
+ REAL(wp) xc
+ REAL(wp) xg
+ DO k = 1, nzt
+ dg = mean_diameter( cloud_species%graupel, xg )
+ dc = mean_diameter( cloud_species%cloud, xc )
+ IF ( dc > dc_crit .AND. dg > df_crit ) THEN
+ riming_rate_n = nc_c ( rime_graupel_cloud_delta_n_aa * dg**2 + dg * dc * dc**2 )
+ ENDIF
+ ENDDO
+ END
+ FUNCTION mean_diameter( specie, particle_mean_mass )
+ CLASS(cloud_coefficients) specie
+ REAL(wp) particle_mean_mass
+ mean_diameter = specie%a * particle_mean_mass**specie%b
+ END
+END
--
2.52.0