aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorMikael Morin <mikael@gcc.gnu.org>2011-08-22 14:07:30 +0000
committerMikael Morin <mikael@gcc.gnu.org>2011-08-22 14:07:30 +0000
commit7d7212ec2b45c2829dba3bd3319fce109cbe7f01 (patch)
tree8f626837e5907081d030dc5bb5973cb4f7079283 /gcc/fortran/resolve.c
parent977e83a3edc1a58077e33143ad3cc1f9349d6197 (diff)
downloadgcc-7d7212ec2b45c2829dba3bd3319fce109cbe7f01.zip
gcc-7d7212ec2b45c2829dba3bd3319fce109cbe7f01.tar.gz
gcc-7d7212ec2b45c2829dba3bd3319fce109cbe7f01.tar.bz2
re PR fortran/50050 (Internal compiler error free_expr0 at expr.c:3709 via gfc_done_2)
2011-08-22 Mikael Morin <mikael.morin@gcc.gnu.org> PR fortran/50050 * gfortran.h (gfc_clear_shape, gfc_free_shape): New prototypes. * expr.c (gfc_clear_shape, gfc_free_shape): New functions. (free_expr0): Re-use gfc_free_shape. * trans-expr.c (gfc_trans_subarray_assign): Ditto. * trans-io.c (transfer_array_component): Ditto. * resolve.c (check_host_association): Ditto. (gfc_expr_to_initialize): Don't force the rank value and free the shape after updating the expression. Recalculate shape and rank. (resolve_where_shape): Re-use gfc_clear_shape. * array.c (gfc_array_ref_shape): Ditto. 2011-08-22 Mikael Morin <mikael.morin@gcc.gnu.org> PR fortran/50050 * gfortran.dg/alloc_comp_initializer_3.f90: New test. From-SVN: r177956
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 85d2091..e342723 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -5199,12 +5199,7 @@ check_host_association (gfc_expr *e)
{
/* Clear the shape, since it might not be valid. */
if (e->shape != NULL)
- {
- for (n = 0; n < e->rank; n++)
- mpz_clear (e->shape[n]);
-
- free (e->shape);
- }
+ gfc_free_shape (&e->shape, e->rank);
/* Give the expression the right symtree! */
gfc_find_sym_tree (e->symtree->name, NULL, 1, &st);
@@ -6559,10 +6554,13 @@ gfc_expr_to_initialize (gfc_expr *e)
for (i = 0; i < ref->u.ar.dimen; i++)
ref->u.ar.start[i] = ref->u.ar.end[i] = ref->u.ar.stride[i] = NULL;
- result->rank = ref->u.ar.dimen;
break;
}
+ gfc_free_shape (&result->shape, result->rank);
+
+ /* Recalculate rank, shape, etc. */
+ gfc_resolve_expr (result);
return result;
}
@@ -8429,11 +8427,8 @@ ignore:
result = SUCCESS;
over:
- for (i--; i >= 0; i--)
- {
- mpz_clear (shape[i]);
- mpz_clear (shape2[i]);
- }
+ gfc_clear_shape (shape, i);
+ gfc_clear_shape (shape2, i);
return result;
}