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] PR38538 - ICE with elemental character function


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


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