diff options
author | vehre <vehre@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-08-08 09:58:21 +0000 |
---|---|---|
committer | vehre <vehre@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-08-08 09:58:21 +0000 |
commit | 8ca5189ad220c386bf6a66f9934fd89fa281cdf2 (patch) | |
tree | 2aecfc38f65dabcc6205d34a288024cf1c120249 /gcc/fortran/trans-array.c | |
parent | 1495e54c434d744a34fa127b98fc1a640d8bf68c (diff) |
gcc/fortran/ChangeLog:
2016-08-08 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/71936
* trans-array.c (gfc_array_allocate): When SOURCE= is a function
stick with the ref of the object to allocate.
gcc/testsuite/ChangeLog:
2016-08-08 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/71936
* gfortran.dg/allocate_with_source_21.f03: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239237 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r-- | gcc/fortran/trans-array.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 0a66f83562c9..450d7db2076a 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -5431,12 +5431,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; } |