if (exp == NULL || (exp->expr_type != EXPR_VARIABLE
&& exp->expr_type != EXPR_FUNCTION
+ && exp->expr_type != EXPR_ARRAY
&& exp->expr_type != EXPR_STRUCTURE))
return;
const gfc_typespec *ts = exp->expr_type == EXPR_STRUCTURE
|| exp->expr_type == EXPR_FUNCTION
+ || exp->expr_type == EXPR_ARRAY
? &exp->ts : &exp->symtree->n.sym->ts;
/* Go to actual component transferred. */
if (exp->expr_type == EXPR_STRUCTURE)
return;
+ if (exp->expr_type == EXPR_ARRAY)
+ return;
+
sym = exp->symtree->n.sym;
if (sym->as != NULL && sym->as->type == AS_ASSUMED_SIZE && exp->ref
--- /dev/null
+! { dg-do compile }
+! PR fortran/100971 - ICE: Bad IO basetype (7)
+! Contributed by G.Steinmetz
+
+program p
+ implicit none
+ type t
+ end type
+ class(t), allocatable :: a, b(:)
+ type(t) :: x, y(1)
+ integer :: i
+ allocate (a,b(1))
+ print *, [a] ! { dg-error "Data transfer element at .1. cannot be polymorphic" }
+ print *, [(b(i),i=1,1)] ! { dg-error "Data transfer element at .1. cannot be polymorphic" }
+ print *, [x]
+ print *, [(y(i),i=1,1)]
+end