[Bug fortran/47240] [F03] segfault with procedure pointer component

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jan 11 11:55:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47240

--- Comment #5 from janus at gcc dot gnu.org 2011-01-11 11:48:52 UTC ---
(In reply to comment #4)
> Index: gcc/fortran/trans-expr.c
> ===================================================================
> --- gcc/fortran/trans-expr.c    (revision 168617)
> +++ gcc/fortran/trans-expr.c    (working copy)
> @@ -3043,8 +3043,9 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol *
>                 && fsym->attr.flavor != FL_PROCEDURE)
>                || (fsym->attr.proc_pointer
>                    && !(e->expr_type == EXPR_VARIABLE
> -                  && e->symtree->n.sym->attr.dummy))
> -              || (e->expr_type == EXPR_VARIABLE
> +                   && e->symtree->n.sym->attr.dummy))
> +              || (fsym->attr.proc_pointer
> +                  && e->expr_type == EXPR_VARIABLE
>                    && gfc_is_proc_ptr_comp (e, NULL))
>                || fsym->attr.allocatable))
>              {

This part is fine and regtests cleanly, however ...


> Index: gcc/fortran/resolve.c
> ===================================================================
> --- gcc/fortran/resolve.c    (revision 168618)
> +++ gcc/fortran/resolve.c    (working copy)
> @@ -4858,6 +4858,9 @@ expression_rank (gfc_expr *e)
> 
>    for (ref = e->ref; ref; ref = ref->next)
>      {
> +      if (ref->type == REF_COMPONENT)
> +    rank = ref->u.c.component->as ? ref->u.c.component->as->rank : 0;
> +
>        if (ref->type != REF_ARRAY)
>      continue;

... this produces loads of regressions.



More information about the Gcc-bugs mailing list