diff options
author | vehre <vehre@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-02-23 10:29:26 +0000 |
---|---|---|
committer | vehre <vehre@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-02-23 10:29:26 +0000 |
commit | f482dff601495c229a690f20d13760c8794ca422 (patch) | |
tree | 32dbc9ce729b00746995438b95c3c519e3e73efe /gcc/fortran/trans-array.c | |
parent | 57ed698b69d967ec3ae6b7f39f847497329ec321 (diff) |
gcc/testsuite/ChangeLog:
2016-02-23 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/67451
* gfortran.dg/coarray_allocate_5.f08: New test.
gcc/fortran/ChangeLog:
2016-02-23 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/67451
* trans-array.c (gfc_array_allocate): Take the attributes from the
expression to allocate and not from the source=-expression.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233625 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r-- | gcc/fortran/trans-array.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 2ff283312b6a..649b80fec847 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -5401,17 +5401,8 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg, if (!retrieve_last_ref (&ref, &prev_ref)) return false; - if (ref->u.ar.type == AR_FULL && expr3 != NULL) - { - /* 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; - alloc_w_e3_arr_spec = true; - } - + /* Take the allocatable and coarray properties solely from the expr-ref's + attributes and not from source=-expression. */ if (!prev_ref) { allocatable = expr->symtree->n.sym->attr.allocatable; @@ -5428,6 +5419,17 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg, if (!dimension) gcc_assert (coarray); + if (ref->u.ar.type == AR_FULL && expr3 != NULL) + { + /* 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; + alloc_w_e3_arr_spec = true; + } + /* Figure out the size of the array. */ switch (ref->u.ar.type) { @@ -5463,7 +5465,8 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg, gfc_init_block (&set_descriptor_block); size = gfc_array_init_size (se->expr, alloc_w_e3_arr_spec ? expr->rank : ref->u.ar.as->rank, - ref->u.ar.as->corank, &offset, lower, upper, + coarray ? ref->u.ar.as->corank : 0, + &offset, lower, upper, &se->pre, &set_descriptor_block, &overflow, expr3_elem_size, nelems, expr3, e3_arr_desc, e3_is_array_constr, expr); |