https://gcc.gnu.org/g:a2338c42150cd33a16f69a0c0fc45955bdd33f8e

commit a2338c42150cd33a16f69a0c0fc45955bdd33f8e
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 eccfcc89da40..86e6515f9cee 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -13058,7 +13058,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;

Reply via email to