===================================================================
@@ -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-28 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/70397
===================================================================
@@ -5390,8 +5390,8 @@
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);
===================================================================
@@ -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-01 Ilya Enkovich <enkovich.gnu@gmail.com>
Backport from mainline r234666.
===================================================================
@@ -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" } }
+