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: Tobias Burnus <burnus at net-b dot de>
- Cc: Mikael Morin <mikael dot morin at sfr dot fr>, gcc-patches <gcc-patches at gcc dot gnu dot org>, "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Date: Mon, 17 Sep 2012 12:38:43 +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> <50560E03.4040708@net-b.de>
Dear Tobias,
> The following test case doesn't work; it should print "Overloaded" - and
> does so with crayftn. But with your patch, it doesn't.
For some reason, I guess, the attribute defined_assign_comp is not
getting passed along to type 'b'.
> + build_assignment (gfc_exec_op op, gfc_expr *expr1, gfc_expr *expr2, +
> gfc_component *comp1, gfc_component *comp2, locus loc)
>
> For comp1/comp2, I am wondering whether one shouldn't add a
> gcc_assert ((comp1 && comp2) || (!comp1 && !comp2));
I guess that it will do no harm and might be advised if this function
is called from elsewhere.
>
>
> + get_temp_from_expr (gfc_expr *e, gfc_namespace *ns)
>
> Not that we make so much use of it, but its symbol could be a candidate for
> attr.artificial. (I don't know whether it should.)
I don't know either. I don't recall even noticing the artificial
attribute. I will follow it up to see what use is made of it and see
if it applies here. Presumably this couples directly to
DECL_ARTIFICIAL?
Thanks for the review.
Paul
PS I really, really want to get used to this PR!
PPS I presume that the reason for two temporaries is clear to you?