https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70937
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ok, ->backend_decl isn't always a decl. Thus sth like the following (I suppose
the check should be done in fortran terms rather than looking at backend_decl)
static void
place_decl_expr (gfc_symbol *sym)
{
if (sym->backend_decl)
{
tree type = sym->backend_decl;
if (DECL_P (sym->backend_decl))
type = TREE_TYPE (type);
else
gcc_assert (TYPE_P (type));
while (POINTER_TYPE_P (type))
type = TREE_TYPE (type);
if (variably_modified_type_p (type, NULL))
{
if (TYPE_NAME (type))
gfc_add_expr_to_block (place_decl_expr_init,
build1 (DECL_EXPR, type, TYPE_NAME (type)));
}
}
}