From de517e644a374f7df40bf0b43254684dab717ac0 Mon Sep 17 00:00:00 2001 From: Andre Vehreschild Date: Mon, 4 Apr 2016 11:32:28 +0200 Subject: re PR fortran/65795 (Segfault (invalid write) for ALLOCATE statement involving COARRAYS) gcc/fortran/ChangeLog: 2016-04-04 Andre Vehreschild PR fortran/65795 * trans-array.c (gfc_array_allocate): When the array is a coarray, do not nullyfing its allocatable components in array_allocate, because the nullify missed the array ref and nullifies the wrong component. Cosmetics. gcc/testsuite/ChangeLog: 2016-04-04 Andre Vehreschild PR fortran/65795 * gfortran.dg/coarray_allocate_6.f08: New test. From-SVN: r234710 --- gcc/fortran/ChangeLog | 8 ++++++++ gcc/fortran/trans-array.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'gcc/fortran') diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5ab7d3f..88ac1cc 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2016-04-04 Andre Vehreschild + + PR fortran/65795 + * trans-array.c (gfc_array_allocate): When the array is a coarray, + do not nullyfing its allocatable components in array_allocate, because + the nullify missed the array ref and nullifies the wrong component. + Cosmetics. + 2016-03-29 Andre Vehreschild PR fortran/70397 diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 649b80f..825dfb8 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -5550,8 +5550,8 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg, else gfc_add_expr_to_block (&se->pre, set_descriptor); - if ((expr->ts.type == BT_DERIVED) - && expr->ts.u.derived->attr.alloc_comp) + if (expr->ts.type == BT_DERIVED && expr->ts.u.derived->attr.alloc_comp + && !coarray) { tmp = gfc_nullify_alloc_comp (expr->ts.u.derived, se->expr, ref->u.ar.as->rank); -- cgit v1.1