+2017-11-10 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/82934
+ * trans-stmt.c (gfc_trans_allocate): Remove the gcc_assert on
+ null string length for assumed length typespec and set
+ expr3_esize to NULL_TREE;
+
2017-11-09 Paul Thomas <pault@gcc.gnu.org>
PR fortran/78619
if (code->ext.alloc.ts.type != BT_CHARACTER)
expr3_esize = TYPE_SIZE_UNIT (
gfc_typenode_for_spec (&code->ext.alloc.ts));
- else
+ else if (code->ext.alloc.ts.u.cl->length != NULL)
{
gfc_expr *sz;
- gcc_assert (code->ext.alloc.ts.u.cl->length != NULL);
sz = gfc_copy_expr (code->ext.alloc.ts.u.cl->length);
gfc_init_se (&se_sz, NULL);
gfc_conv_expr (&se_sz, sz);
tmp, se_sz.expr);
expr3_esize = gfc_evaluate_now (expr3_esize, &block);
}
+ else
+ expr3_esize = NULL_TREE;
}
/* The routine gfc_trans_assignment () already implements all
+2017-11-10 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/82934
+ * gfortran.dg/allocate_assumed_charlen_1.f90: New test.
+
2017-11-10 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/82916
--- /dev/null
+! { dg-do run }
+!
+! PR82934: Segfault on compilation in trans-stmt.c:5919(8.0.0).
+! The original report only had one item in the allocate list. This
+! has been doubled up to verify that the correct string length is
+! is used in the allocation.
+!
+! Contributed by FortranFan on clf.
+!
+ character(len=42), allocatable :: foo
+ character(len=22), allocatable :: foofoo
+
+ call alloc( foo , foofoo)
+
+ if (len(foo) .ne. 42) call abort
+ if (len(foofoo) .ne. 22) call abort
+
+contains
+
+ subroutine alloc( bar, barbar )
+
+ character(len=*), allocatable :: bar, barbar
+
+ allocate( character(len=*) :: bar , barbar) ! <= Here!
+
+ end subroutine
+
+end