2021-01-05 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/93794
* trans-expr.c (gfc_conv_component_ref): Remove the condition
that deferred character length components only be allocatable.
gcc/testsuite/
PR fortran/93794
* gfortran.dg/deferred_character_35.f90 : New test.
/* Allocatable deferred char arrays are to be handled by the gfc_deferred_
strlen () conditional below. */
if (c->ts.type == BT_CHARACTER && !c->attr.proc_pointer
- && !(c->attr.allocatable && c->ts.deferred)
+ && !c->ts.deferred
&& !c->attr.pdt_string)
{
tmp = c->ts.u.cl->backend_decl;
--- /dev/null
+! { dg-do compile }
+!
+! Test the fix for PR93794, where the ASSOCIATE statement ICED on the
+! deferred character length, pointer component.
+!
+! Contributed by Gerhard Steinmetz <gscfq@t-online.de>
+!
+program p
+ type t
+ character(:), pointer :: a
+ end type
+ type(t) :: z
+ character(4), target :: c = 'abcd'
+ z%a => c
+ associate (y => z%a)
+ print *, y
+ end associate
+end