[gcc(refs/users/mikael/heads/refactor_descriptor_v05)] Correction ICE PR93308
Mikael Morin
mikael@gcc.gnu.org
Fri Jun 13 14:54:36 GMT 2025
https://gcc.gnu.org/g:860623ec353c808d7eb534f3d35e1e4c0218f58c
commit 860623ec353c808d7eb534f3d35e1e4c0218f58c
Author: Mikael Morin <mikael@gcc.gnu.org>
Date: Fri Apr 11 12:27:53 2025 +0200
Correction ICE PR93308
Diff:
---
gcc/fortran/trans-array.cc | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 022940f3f482..2741fc3ffe6e 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -6007,6 +6007,7 @@ gfc_conv_array_initializer (tree type, gfc_expr * expr)
{
gfc_constructor *c;
tree tmp;
+ tree min_index = NULL_TREE;
gfc_se se;
tree index, range;
vec<constructor_elt, va_gc> *v = NULL;
@@ -6043,6 +6044,9 @@ gfc_conv_array_initializer (tree type, gfc_expr * expr)
break;
case EXPR_ARRAY:
+ if (TYPE_DOMAIN (type))
+ min_index = TYPE_MIN_VALUE (TYPE_DOMAIN (type));
+
/* Create a vector of all the elements. */
for (c = gfc_constructor_first (expr->value.constructor);
c && c->expr; c = gfc_constructor_next (c))
@@ -6062,6 +6066,9 @@ gfc_conv_array_initializer (tree type, gfc_expr * expr)
index = gfc_conv_mpz_to_tree (c->offset, gfc_index_integer_kind);
else
index = NULL_TREE;
+ if (index && min_index)
+ index = fold_build2_loc (input_location, PLUS_EXPR,
+ TREE_TYPE (index), index, min_index);
if (mpz_cmp_si (c->repeat, 1) > 0)
{
More information about the Gcc-cvs
mailing list