https://gcc.gnu.org/g:c84be8eeefb2881ebf1fa8c3ccd810c9e823fddf
commit c84be8eeefb2881ebf1fa8c3ccd810c9e823fddf Author: Mikael Morin <mik...@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; }