This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

[PATCH,fortran] Fix logical comparison diagnostic message


This probably qualifies as "obviously correct", but it someone
would cast an eye of the patch I'd appreciate it.


2007-07-26  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/32899
	* gfortran.dg/logical_comparison.f90: New test.


2007-07-26  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/32899
	* fortran/resolve.c: Add INTRINSIC_EQ_OS comparison.

-- 
Steve
Index: testsuite/gfortran.dg/logical_comparison.f90
===================================================================
--- testsuite/gfortran.dg/logical_comparison.f90	(revision 0)
+++ testsuite/gfortran.dg/logical_comparison.f90	(revision 0)
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/32899
+subroutine sub
+  logical a
+  a = .true.
+  a = a .eq. a ! { dg-error "must be compared with" }
+  a = a .ne. a ! { dg-error "must be compared with" }
+end subroutine sub
Index: fortran/resolve.c
===================================================================
--- fortran/resolve.c	(revision 126917)
+++ fortran/resolve.c	(working copy)
@@ -2830,8 +2830,9 @@ resolve_operator (gfc_expr *e)
       if (op1->ts.type == BT_LOGICAL && op2->ts.type == BT_LOGICAL)
 	sprintf (msg,
 		 _("Logicals at %%L must be compared with %s instead of %s"),
-		 e->value.op.operator == INTRINSIC_EQ ? ".eqv." : ".neqv.",
-		 gfc_op2string (e->value.op.operator));
+		 (e->value.op.operator == INTRINSIC_EQ 
+		  || e->value.op.operator == INTRINSIC_EQ_OS)
+		 ? ".eqv." : ".neqv.", gfc_op2string (e->value.op.operator));
       else
 	sprintf (msg,
 		 _("Operands of comparison operator '%s' at %%L are %s/%s"),

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