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

--- Comment #6 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #5)
> Perhaps
>   if (state == COMP_BLOCK && !got_matching_end)
>     {
>       parent_ns = gfc_current_ns->parent;
> 
>       nsp = &(gfc_state_stack->previous->tail->ext.block.ns);
> 
>       prev_ns = NULL;
>       ns = *nsp;
>       while (ns)
>         {
>           if (ns == gfc_current_ns)
>             {
>               if (prev_ns == NULL)
>                 *nsp = NULL;
>               else
>                 prev_ns->sibling = ns->sibling;
>             }
>           prev_ns = ns;
>           ns = ns->sibling;
>         }
>         
>       gfc_free_namespace (gfc_current_ns);
>       gfc_current_ns = parent_ns;
>       gfc_state_stack = gfc_state_stack->previous;
>       state = gfc_current_state ();
>     }
> shouldn't it instead of freeing the namespace just mark it for later
> gfc_free_namespace by parse_block_construct or parse_omp_structured_block?

An actual patch here would be helpful.

Reply via email to