This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran, F03] PR 40870: include formal args in backend_decl of PPCs


2009/8/18 Tobias Burnus <burnus@net-b.de>:
>> Updated patch (based on Paul's version) is attached. Ok to commit
>> after another regtest?
>
> It looks OK, except I stumbled over:
>
> + ?/* Implicit interface (only return value may be known). ?*/
> ? if (c->attr.function && !c->attr.dimension)
> [...]
> + ? ?t = gfc_typenode_for_spec (&c->ts);
> ? else
> ? ? t = void_type_node;
>
>
> And wondered about the "dimension" attribute. And indeed, checking for
> dimension is not enough as the following example shows:

You're right. I added a check for CHARACTER types now (regarding the
other checks in gfc_return_by_reference: g77 compatibility is probably
not so important for PPCs).


> module m
> ?type :: t
> ?procedure(character(len=5)), pointer, nopass :: ptr
> ?end type
> contains
> ?function abc()
> ? character(len=5) :: abc
> ? abc = 'abcde'
> ?end function abc
> end module m
>
> use m
> ?type(t) :: x
> ?character(len=5) :: str
> ?x%ptr => abc
> ?str = x%ptr()
> end
>
>
> That crashes with:
>
> test.f90: In function 'MAIN__':
> test.f90:12:0: internal compiler error: in gfc_conv_component_ref, at
> fortran/trans-expr.c:477

I'm afraid CHARACTER types are a bit of a stepchild in the procptr
implementation. Your test case fails with the same error when using
"procedure(abc), pointer, nopass :: ptr", which means that this is not
directly connected to the piece of code you quoted above. Moreover,
already the following fails (with a different error):

procedure(character(len=5)), pointer :: pp
pp => abc
contains
 function abc()
  character(len=5) :: abc
  abc = 'abcde'
 end function abc
end

My suggestion would be to commit the patch as attached, and open a new
PR for the CHARACTER problems. Is that ok?

Cheers,
Janus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]