This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, fortran] PR38538 - ICE with elemental character function
- From: Daniel Kraft <d at domob dot eu>
- To: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- Cc: gfortran <fortran at gcc dot gnu dot org>, gcc patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 14 Mar 2009 08:53:32 +0100
- Subject: Re: [Patch, fortran] PR38538 - ICE with elemental character function
- References: <339c37f20903121341s14da2db0ga83cc1b82c3e34e2@mail.gmail.com>
Hi Paul,
thanks for the patch!
Paul Richard Thomas wrote:
This replaces a previous, partial fix that only applied to elemental
functions. As the testcase shows, this is more general and exploits
the interface mapping mechanics to deal with function character
lengths in expressions.
I was stuck with one regression, using the patch in comment #10 in the
PR - this fixes it.
Bootstrapped and regtested on FC9/x86_i64 - OK for 4.5?
Looks good, ok. See my comments below though, and you may want to
accordingly change some details.
Thanks for the patch!
Daniel
+ if (expr->value.op.op2)
+ {
+ get_array_charlen (expr->value.op.op2, se);
+
+ /* Add the string lengths and assign them to the expression
+ string length backend declaration. */
+ gfc_add_modify (&se->pre, expr->ts.cl->backend_decl,
+ fold_build2 (PLUS_EXPR, gfc_charlen_type_node,
+ expr->value.op.op1->ts.cl->backend_decl,
+ expr->value.op.op2->ts.cl->backend_decl));
+ }
Not sure if I got this one correctly, but it seems to me this handles
the concatenation operator; if not, I do not see why we simply add the
lengths and are done. If I'm right, maybe we should at least assert it
here?
+ if (formal->sym)
+ gfc_add_interface_mapping (&mapping, formal->sym, NULL, arg->expr);
Indentation looks wrong, but may be my mail program or same tabs thing.
--
Done: Arc-Bar-Cav-Ran-Rog-Sam-Tou-Val-Wiz
To go: Hea-Kni-Mon-Pri