https://gcc.gnu.org/g:94c2167fd12565fdf47877afe70528e9a02c1568
commit 94c2167fd12565fdf47877afe70528e9a02c1568 Author: Mikael Morin <mik...@gcc.gnu.org> Date: Wed May 14 10:11:03 2025 +0200 Revert "Correction régression power_4" This reverts commit 75d789cc46aa5a680db11715b1130fe14c23be29. Diff: --- gcc/tree.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gcc/tree.cc b/gcc/tree.cc index dcc1abd0542f..6148ac1512c9 100644 --- a/gcc/tree.cc +++ b/gcc/tree.cc @@ -13108,7 +13108,17 @@ array_ref_up_bound (tree exp) /* If there is a domain type and it has an upper bound, use it, substituting for a PLACEHOLDER_EXPR as needed. */ if (domain_type && TYPE_MAX_VALUE (domain_type)) - return SUBSTITUTE_PLACEHOLDER_IN_EXPR (TYPE_MAX_VALUE (domain_type), exp); + { + tree val = SUBSTITUTE_PLACEHOLDER_IN_EXPR (TYPE_MAX_VALUE (domain_type), exp); + if (TREE_OPERAND (exp, 2)) + return fold_build2_loc (EXPR_LOCATION (exp), PLUS_EXPR, + TREE_TYPE (val), val, + fold_convert_loc (EXPR_LOCATION (exp), + TREE_TYPE (val), + TREE_OPERAND (exp, 2))); + else + return val; + } /* Otherwise fail. */ return NULL_TREE;