===================================================================
@@ -748,13 +748,15 @@ char_len_param_value (gfc_expr **expr, b
/* This catches the invalid code "[character(m(2:3)) :: 'x', 'y']",
which causes an ICE if gfc_reduce_init_expr() is called. */
- if (e->ref && e->ref->u.ar.type == AR_UNKNOWN
+ if (e->ref && e->ref->type == REF_ARRAY
+ && e->ref->u.ar.type == AR_UNKNOWN
&& e->ref->u.ar.dimen_type[0] == DIMEN_RANGE)
goto syntax;
gfc_reduce_init_expr (e);
- if ((e->ref && e->ref->u.ar.type != AR_ELEMENT)
+ if ((e->ref && e->ref->type == REF_ARRAY
+ && e->ref->u.ar.type != AR_ELEMENT)
|| (!e->ref && e->expr_type == EXPR_ARRAY))
{
gfc_free_expr (e);
===================================================================
@@ -0,0 +1,22 @@
+! { dg-do compile }
+! PR fortran/68108
+! Code contributed by Juergen Reuter (juergen.reuter at desy dot de)
+! Test fix for regression caused by PR fortran/67805.
+module lexers
+ implicit none
+ type :: template_t
+ character(256) :: charset1
+ integer :: len1
+ end type template_t
+
+contains
+
+ subroutine match_quoted (tt, s, n)
+ type(template_t), intent(in) :: tt
+ character(*), intent(in) :: s
+ integer, intent(out) :: n
+ character(tt%len1) :: ch1
+ ch1 = tt%charset1
+ end subroutine match_quoted
+
+end module lexers