[gcc(refs/users/mikael/heads/refactor_descriptor_v05)] Correction régression unsigned_23
Mikael Morin
mikael@gcc.gnu.org
Fri Jun 13 15:04:32 GMT 2025
https://gcc.gnu.org/g:6f731aed0fd2a9579087ff7c2afe6791e9ec123a
commit 6f731aed0fd2a9579087ff7c2afe6791e9ec123a
Author: Mikael Morin <mikael@gcc.gnu.org>
Date: Wed May 14 10:40:17 2025 +0200
Correction régression unsigned_23
Diff:
---
gcc/tree.cc | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/gcc/tree.cc b/gcc/tree.cc
index fa5df47e8111..aebb09ff0825 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -13048,12 +13048,22 @@ array_ref_up_bound (tree exp)
if (domain_type && TYPE_MAX_VALUE (domain_type))
{
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)));
+ tree low_bnd = TREE_OPERAND (exp, 2);
+ if (low_bnd)
+ {
+ tree dom_min = TYPE_MIN_VALUE (domain_type);
+ tree off = fold_build2_loc (EXPR_LOCATION (exp), MINUS_EXPR,
+ TREE_TYPE (val),
+ fold_convert_loc (EXPR_LOCATION (low_bnd),
+ TREE_TYPE (val),
+ low_bnd),
+ fold_convert_loc (EXPR_LOCATION (dom_min),
+ TREE_TYPE (val),
+ dom_min));
+
+ return fold_build2_loc (EXPR_LOCATION (exp), PLUS_EXPR,
+ TREE_TYPE (val), val, off);
+ }
else
return val;
}
More information about the Gcc-cvs
mailing list