{
gfc_symbol *psym = expr1->symtree->n.sym;
tmp = NULL_TREE;
- if (psym->ts.type == BT_CHARACTER)
- {
- gcc_assert (psym->ts.u.cl->backend_decl
- && VAR_P (psym->ts.u.cl->backend_decl));
- tmp = psym->ts.u.cl->backend_decl;
- }
+ if (psym->ts.type == BT_CHARACTER
+ && psym->ts.u.cl->backend_decl)
+ tmp = psym->ts.u.cl->backend_decl;
else if (expr1->ts.u.cl->backend_decl
&& VAR_P (expr1->ts.u.cl->backend_decl))
tmp = expr1->ts.u.cl->backend_decl;
--- /dev/null
+! { dg-do run }
+! Test the fix for PR113956
+! Contributed by David Binderman <dcb314@hotmail.com>
+module m
+contains
+ subroutine test_array_char(p, x)
+ character(*), target :: x(:)
+ character(:), pointer :: p(:)
+ p => x ! ICE
+ end subroutine
+end module
+
+ use m
+ character(:), allocatable, target :: chr(:)
+ character(:), pointer :: p(:)
+ chr = ["ab","cd"]
+ call test_array_char (p, chr)
+ if (loc (chr) .ne. loc (p)) stop 1
+ if (len (p) .ne. 2) stop 2
+ if (any (p .ne. chr)) stop 3
+end