This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, fortran] PR46897 - [OOP] type-bound defined ASSIGNMENT(=) not used for derived type component in intrinsic assign
- From: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- To: Mikael Morin <mikael dot morin at sfr dot fr>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, Tobias Burnus <burnus at net-b dot de>
- Date: Wed, 19 Sep 2012 20:46:39 +0200
- Subject: Re: [Patch, fortran] PR46897 - [OOP] type-bound defined ASSIGNMENT(=) not used for derived type component in intrinsic assign
- References: <CAGkQGiLUJSqmV-CdnbiK=iVMsfgP62a3X28kDsCsXUDjPTNa3A@mail.gmail.com> <50294461.2070704@sfr.fr> <CAGkQGiL9Y9b1JCYSE7ftv5J=WOfF80MTMhH3CaSrgKShD4JSjg@mail.gmail.com> <502A0F81.7060106@sfr.fr> <CAGkQGi+wqPFad_oZBOv3fCZFpr17rbA1B_kU5AC-d9NXwc3KOg@mail.gmail.com> <CAGkQGiKUfxLdbGaC0Xa=xs9BZiybvJBBvyjnEPLnoqrjyZUTyw@mail.gmail.com> <50576FE4.7040008@sfr.fr>
Dear Mikael,
Thanks for the usually thorough review.
....snip....
> And here comes the next round of comments.
....snip....
>> + e->rank = c && c->as ? c->as->rank : 0;
> This is bogus if e->rank was != 0 previously (think of the case
> array(:)%scalar_comp).
mistaken maybe but not bogus!
> The c == NULL case should be handled at the beginning (if at all).
>
>> + if (e->rank)
> the condition should be on c->as (for the case array(:)%scalar_comp again).
OK point taken.
....snip...
>> + this_code->op = op;
> all calls are with op == EXEC_ASSIGN, you may as well hardcode it.
I thought to leave it general so that the function could be reused for
other purposes.
....snip...
.
>> + gcc_assert (e->expr_type == EXPR_VARIABLE
>> + || e->expr_type == EXPR_FUNCTION);
> As far as I know anything can be used, not only variables and functions.
> The derived type cases are a bit specific but at least array/structure
> constructors are missing. There could be also typebound function calls
> (I never know whether they are EXPR_FUNCTION or something else).
The reason for this assert is the later use of e->symtree. I'll see
what I can do to generalise it.
....snip....
> I guess it should be `t1%cmp {defined=} expr2%cmp'?
mmmm..... it might just be
>> + || comp1->attr.proc_pointer_comp
> That one doesn't look right.
Why not?
> `this_code' should be cleared, otherwise it is used in the next iteration.
I'll check that this is not done in gfc_free_statements (no source to
hand at the moment) - I believe that it is.
....snip...
>> + = super_type->attr.defined_assign_comp;
> I guess Tobias' reported bug is here. The flag shouldn't be cleared
> here if it was set just before.
>
I am sure that it is in this vicinity.... :-)
>
> To finish, I would like to draw your attention on the scalarizer not
> supporting multiple arrays in the reference chain. The initial
> expressions are guaranteed to have at most one array in the chain, but
> as we add subfield references, that condition can not remain true. We
> could try adding multiple references support in the scalarizer, but I
> don't know how difficult it would be. Or maybe better fix it at the
> front-end AST level by using elemental functions to split the
> scalarization work. Or something else. What do you think?
resolve_expr punts on this, does it not? I'll check.
I cannot conceivably come back to this for a week or so because
daytime and private life are overwhelmingly hectic (wife and daughter
moving back to UK).
Thanks again
Paul