Patchwork [fortran] PR 45338 - ICE with user-defined operator

login
register
mail settings
Submitter Thomas Koenig
Date Dec. 30, 2010, 10:49 a.m.
Message ID <1293706140.3687.2.camel@linux-fd1f.site>
Download mbox | patch
Permalink /patch/76965/
State New
Headers show

Comments

Thomas Koenig - Dec. 30, 2010, 10:49 a.m.
Hello world,

the attached, fairly straightforward, patch fixes the PR.
Regression-tested.  OK for trunk?

	Thomas

2010-12-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/45338
	* resolve.c (resolve_operator):  Mark function for user-defined
	operator as referenced.

2010-12-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/45338
	* gfortran.dg/userdef_operator_2.f90:  New test case.
Tobias Burnus - Dec. 31, 2010, 10:53 a.m.
Thomas Koenig wrote:
> the attached, fairly straightforward, patch fixes the PR.
> Regression-tested.  OK for trunk?

OK. Thanks for the patch - and happy new year to everyone.

Tobias

> 2010-12-30  Thomas Koenig<tkoenig@gcc.gnu.org>
>
> 	PR fortran/45338
> 	* resolve.c (resolve_operator):  Mark function for user-defined
> 	operator as referenced.
>
> 2010-12-30  Thomas Koenig<tkoenig@gcc.gnu.org>
>
> 	PR fortran/45338
> 	* gfortran.dg/userdef_operator_2.f90:  New test case.
>
Thomas Koenig - Dec. 31, 2010, 11:25 a.m.
Hello Tobias,

> Thomas Koenig wrote:
> > the attached, fairly straightforward, patch fixes the PR.
> > Regression-tested.  OK for trunk?
> 
> OK. Thanks for the patch - and happy new year to everyone.

Sende          fortran/ChangeLog
Sende          fortran/resolve.c
Sende          testsuite/ChangeLog
Hinzufügen     testsuite/gfortran.dg/userdef_operator_2.f90
Übertrage Daten ....
Revision 168366 übertragen.

As 4.5 is also affected, I plan on backporting in a few days.

Thanks for the review, and happy new year to everybody from me as well!

	Thomas

Patch

Index: resolve.c
===================================================================
--- resolve.c	(Revision 168201)
+++ resolve.c	(Arbeitskopie)
@@ -3793,9 +3793,12 @@  resolve_operator (gfc_expr *e)
 	sprintf (msg, _("Operand of user operator '%s' at %%L is %s"),
 		 e->value.op.uop->name, gfc_typename (&op1->ts));
       else
-	sprintf (msg, _("Operands of user operator '%s' at %%L are %s/%s"),
-		 e->value.op.uop->name, gfc_typename (&op1->ts),
-		 gfc_typename (&op2->ts));
+	{
+	  sprintf (msg, _("Operands of user operator '%s' at %%L are %s/%s"),
+		   e->value.op.uop->name, gfc_typename (&op1->ts),
+		   gfc_typename (&op2->ts));
+	  e->value.op.uop->op->sym->attr.referenced = 1;
+	}
 
       goto bad_op;