https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128093

--- Comment #4 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Paul Thomas from comment #3)
>             init_expr->param_list = NULL;
> >           gfc_replace_expr (init_expr, var);
> >           /* Deallocate temporary PDT's allocatable components.  */
> > -         if (var->symtree->n.sym->ts.u.derived->attr.alloc_comp)
> > +         if (init_expr->symtree->n.sym->ts.u.derived->attr.alloc_comp)
> >             {
> > -             tree var_decl = gfc_get_symbol_decl (var->symtree->n.sym);
> > -             tmp = gfc_deallocate_pdt_comp 
> > (var->symtree->n.sym->ts.u.derived,
> > +             tree var_decl = gfc_get_symbol_decl 
> > (init_expr->symtree->n.sym);
> > +             tmp = gfc_deallocate_pdt_comp 
> > (init_expr->symtree->n.sym->ts.u.derived,
> >                                             var_decl, 0);
> >               gfc_add_expr_to_block (&block, tmp);
> >             }
> 
> Iain,
> 
> The current state should not have worked on any platform IMHO.
> 
> Moving gfc_replace_expr (init_expr, var); to after the deallocation of PDT
> components fixes the problem too, does it not?

I would expect so - and a smaller patch - but I didn't check for any potential
fallout ...

Reply via email to