diff options
author | Andre Vehreschild <vehre@gcc.gnu.org> | 2016-04-04 09:32:28 +0000 |
---|---|---|
committer | Andre Vehreschild <vehre@gcc.gnu.org> | 2016-04-04 09:32:28 +0000 |
commit | 477771929f25a9c7cf56bb0dddb416e94876614d (patch) | |
tree | 0359da9c7ee2fde9145b6988e87491fb19e9ceb8 | |
parent | f3433b1709133f76d99ae7b26e91a08ca80cfbec (diff) |
gcc/fortran/ChangeLog:
2016-04-04 Andre Vehreschild <vehre@gcc.gnu.org>
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 <vehre@gcc.gnu.org>
PR fortran/65795
* gfortran.dg/coarray_allocate_6.f08: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@234710 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/fortran/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/fortran/trans-array.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/coarray_allocate_6.f08 | 27 |
4 files changed, 42 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5ab7d3ff285..88ac1cc352e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2016-04-04 Andre Vehreschild <vehre@gcc.gnu.org> + + 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 <vehre@gcc.gnu.org> PR fortran/70397 diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 649b80fec84..825dfb822af 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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 43bad0faaa2..47656a92652 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-04-04 Andre Vehreschild <vehre@gcc.gnu.org> + + PR fortran/65795 + * gfortran.dg/coarray_allocate_6.f08: New test. + 2016-04-04 Richard Biener <rguenther@suse.de> PR rtl-optimization/70484 diff --git a/gcc/testsuite/gfortran.dg/coarray_allocate_6.f08 b/gcc/testsuite/gfortran.dg/coarray_allocate_6.f08 new file mode 100644 index 00000000000..2fdd4c128ef --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_allocate_6.f08 @@ -0,0 +1,27 @@ +! { dg-do run } +! { dg-options "-fcoarray=single -fdump-tree-original" } + +! Contributed by Tobias Burnus <burnus@gcc.gnu.org> +! Test fix for pr65795. + +implicit none + +type t2 + integer, allocatable :: x +end type t2 + +type t3 + type(t2), allocatable :: caf[:] +end type t3 + +!type(t3), save, target :: c, d +type(t3), target :: c, d +integer :: stat + +allocate(c%caf[*], stat=stat) +end + +! Besides checking that the executable does not crash anymore, check +! that the cause has been remove. +! { dg-final { scan-tree-dump-not "c.caf.x = 0B" "original" } } + |