[gcc(refs/users/mikael/heads/refactor_descriptor_v08)] gimple-simulate: Correction ICE évaluation adresse

Mikael Morin mikael@gcc.gnu.org
Fri Sep 19 19:12:51 GMT 2025


https://gcc.gnu.org/g:59f2be4e1932914befccbea7c6725573f723647f

commit 59f2be4e1932914befccbea7c6725573f723647f
Author: Mikael Morin <mikael@gcc.gnu.org>
Date:   Fri Aug 29 17:10:53 2025 +0200

    gimple-simulate: Correction ICE évaluation adresse

Diff:
---
 gcc/gimple-simulate.cc | 26 ++++++++++++++++++++++++--
 gcc/tree-dfa.cc        |  1 +
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/gcc/gimple-simulate.cc b/gcc/gimple-simulate.cc
index 247b3829c3c6..e0cf25eb97aa 100644
--- a/gcc/gimple-simulate.cc
+++ b/gcc/gimple-simulate.cc
@@ -43,6 +43,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "gimple-pretty-print.h"
 #include "gimple-iterator.h"
 #include "gimple-ssa.h"
+#include "gimple-fold.h"
 #include "cgraph.h"
 #include "stringpool.h"
 #include "value-range.h"
@@ -1849,6 +1850,26 @@ simul_scope::get_storage (unsigned idx) const
 }
 
 
+tree
+simul_valueize (tree t)
+{
+  if (TREE_CODE (t) == SSA_NAME)
+    {
+      gimple * def = SSA_NAME_DEF_STMT (t);
+
+      if (gimple_code (def) == GIMPLE_ASSIGN
+	  && gimple_assign_rhs_code (def) == ADDR_EXPR)
+	return gimple_assign_rhs1 (def);
+
+      tree c = gimple_fold_stmt_to_constant (def, simul_valueize);
+      if (c != NULL_TREE)
+	return c;
+    }
+
+  return t;
+}
+
+
 /* Evaluate the expression EXPR using the values currently stored in
    accessible variables and allocated storages and return the resulting value.
    */
@@ -1916,8 +1937,9 @@ simul_scope::evaluate (tree expr) const
 	else
 	  {
 	    poly_int64 offset;
-	    tree var = get_addr_base_and_unit_offset (TREE_OPERAND (expr, 0),
-						      &offset);
+	    tree var = get_addr_base_and_unit_offset_1 (TREE_OPERAND (expr, 0),
+							&offset,
+							simul_valueize);
 
 	    HOST_WIDE_INT off;
 	    bool is_constant = offset.is_constant (&off);
diff --git a/gcc/tree-dfa.cc b/gcc/tree-dfa.cc
index e25d5c05ca2f..a91f17ca6680 100644
--- a/gcc/tree-dfa.cc
+++ b/gcc/tree-dfa.cc
@@ -863,6 +863,7 @@ get_addr_base_and_unit_offset_1 (tree exp, poly_int64 *poffset,
 		    byte_offset += off.force_shwi ();
 		  }
 		exp = TREE_OPERAND (base, 0);
+		continue;
 	      }
 	    goto done;
 	  }


More information about the Gcc-cvs mailing list