This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: SoC fortran procedure pointers
Paul Thomas wrote:
> Are you sure that the patch applied cleanly? That error message
> comes from symbol.c(check_conflict) (I think that I have the function
> name right :-) ).
Well, there are are a couple of problems in patch posted by Janus (I did
not look at the original patch):
This error
>> Error: EXTERNAL attribute conflicts with FUNCTION attribute in 'a' at (1)
is due to
>> Index: gcc/fortran/decl.c
>> ===================================================================
>> +gfc_match_procedure (void)
>> + if (!current_attr.pointer)
>> + sym->attr.external = 1;
The following is strange
>> + if (s != NULL && !(s->attr.procedure && s->formal == NULL))
>> + {
>> + sym->formal = gfc_get_formal_arglist ();
>> + if (s->attr.procedure)
>> + sym->formal->sym = s->formal->sym;
>> + else
>> + sym->formal->sym = s;
>> + }
The outer if excludes s->attr.procedure, which is then used in the inner if.
>> Index: gcc/fortran/resolve.c
>> + if (sym->attr.procedure && sym->formal != NULL)
>> + {
>> + gfc_formal_arglist *f = sym->formal;
>> + sym->ts = f->sym->ts;
>> + sym->attr.function = f->sym->attr.function;
>> + sym->attr.subroutine = f->sym->attr.subroutine;
>> + sym->formal = f->sym->formal;
>> + sym->attr.if_source = IFSRC_DECL;
>> + gfc_free_formal_arglist (f);
>> + }
For some reason is sym->formal == NULL afterwards (cf. the sym->formal
assignment in decl.c).
Even with some fixes for these, I only get ICEs with a stripped-down
version of the testcase.
Tobias