This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/47240] [F03] segfault with procedure pointer component
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 11 Jan 2011 11:49:02 +0000
- Subject: [Bug fortran/47240] [F03] segfault with procedure pointer component
- Auto-submitted: auto-generated
- References: <bug-47240-4@http.gcc.gnu.org/bugzilla/>
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.