summaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-array.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r--gcc/fortran/trans-array.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 825dfb822a..0882a3a0e7 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -5421,12 +5421,19 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg,
if (ref->u.ar.type == AR_FULL && expr3 != NULL)
{
+ gfc_ref *old_ref = ref;
/* F08:C633: Array shape from expr3. */
ref = expr3->ref;
/* Find the last reference in the chain. */
if (!retrieve_last_ref (&ref, &prev_ref))
- return false;
+ {
+ if (expr3->expr_type == EXPR_FUNCTION
+ && gfc_expr_attr (expr3).dimension)
+ ref = old_ref;
+ else
+ return false;
+ }
alloc_w_e3_arr_spec = true;
}
@@ -6093,7 +6100,12 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc,
return;
}
+ loc.nextc = NULL;
gfc_save_backend_locus (&loc);
+ /* loc.nextc is not set by save_backend_locus but the location routines
+ depend on it. */
+ if (loc.nextc == NULL)
+ loc.nextc = loc.lb->line;
gfc_set_backend_locus (&sym->declared_at);
/* Descriptor type. */
@@ -6376,7 +6388,12 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc,
stmtCleanup = gfc_finish_block (&cleanup);
/* Only do the cleanup if the array was repacked. */
- tmp = build_fold_indirect_ref_loc (input_location, dumdesc);
+ if (is_classarray)
+ /* For a class array the dummy array descriptor is in the _class
+ component. */
+ tmp = gfc_class_data_get (dumdesc);
+ else
+ tmp = build_fold_indirect_ref_loc (input_location, dumdesc);
tmp = gfc_conv_descriptor_data_get (tmp);
tmp = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
tmp, tmpdesc);