[gcc(refs/users/mikael/heads/refactor_descriptor_v05)] Correction ICE 20231103-1
Mikael Morin
mikael@gcc.gnu.org
Fri Jun 13 14:54:51 GMT 2025
https://gcc.gnu.org/g:9234efd7d0a9ecd4b72686d7fc97eaef4e5ddc4d
commit 9234efd7d0a9ecd4b72686d7fc97eaef4e5ddc4d
Author: Mikael Morin <mikael@gcc.gnu.org>
Date: Fri Apr 11 16:02:38 2025 +0200
Correction ICE 20231103-1
Diff:
---
gcc/fortran/trans-decl.cc | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc
index dfcee60cd2be..4ef91d1cb65c 100644
--- a/gcc/fortran/trans-decl.cc
+++ b/gcc/fortran/trans-decl.cc
@@ -1046,11 +1046,23 @@ update_type_bounds (tree type, tree lbound[GFC_MAX_DIMENSIONS],
|| current_ubound != NULL_TREE
|| elt_type != TREE_TYPE (type))
{
- tree new_type = build_variant_type_copy (type);
+ tree new_type = build_distinct_type_copy (type);
TREE_TYPE (new_type) = elt_type;
- TYPE_DOMAIN (new_type) = build_variant_type_copy (TYPE_DOMAIN (type));
- TYPE_MIN_VALUE (TYPE_DOMAIN (new_type)) = current_lbound;
- TYPE_MAX_VALUE (TYPE_DOMAIN (new_type)) = current_ubound;
+ TYPE_DOMAIN (new_type) = build_distinct_type_copy (TYPE_DOMAIN (type));
+
+ tree new_lbound = current_lbound;
+ if (new_lbound == NULL_TREE)
+ new_lbound = TYPE_MIN_VALUE (TYPE_DOMAIN (type));
+ TYPE_MIN_VALUE (TYPE_DOMAIN (new_type)) = new_lbound;
+
+ tree new_ubound = current_ubound;
+ if (new_ubound == NULL_TREE)
+ new_ubound = TYPE_MAX_VALUE (TYPE_DOMAIN (type));
+ TYPE_MAX_VALUE (TYPE_DOMAIN (new_type)) = new_ubound;
+
+ layout_type (TYPE_DOMAIN (new_type));
+ layout_type (new_type);
+
type = new_type;
}
More information about the Gcc-cvs
mailing list