public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH,fortran] Fix logical comparison diagnostic message
@ 2007-07-26 17:27 Steve Kargl
  2007-07-26 17:34 ` Daniel Franke
  0 siblings, 1 reply; 3+ messages in thread
From: Steve Kargl @ 2007-07-26 17:27 UTC (permalink / raw)
  To: fortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 367 bytes --]

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

[-- Attachment #2: pr32899.diff --]
[-- Type: text/x-diff, Size: 1202 bytes --]

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"),

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH,fortran] Fix logical comparison diagnostic message
  2007-07-26 17:27 [PATCH,fortran] Fix logical comparison diagnostic message Steve Kargl
@ 2007-07-26 17:34 ` Daniel Franke
  2007-07-26 17:40   ` Steve Kargl
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Franke @ 2007-07-26 17:34 UTC (permalink / raw)
  To: fortran; +Cc: Steve Kargl, gcc-patches

On Thursday 26 July 2007 19:00:57 Steve Kargl wrote:
> This probably qualifies as "obviously correct", but it someone
> would cast an eye of the patch I'd appreciate it.

Steve,
as the one who caused this regression, I think it looks ok.

One note: there is logical_comp.f90 in the testsuite which already includes 
these tests.

Thanks for fixing.

	Daniel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH,fortran] Fix logical comparison diagnostic message
  2007-07-26 17:34 ` Daniel Franke
@ 2007-07-26 17:40   ` Steve Kargl
  0 siblings, 0 replies; 3+ messages in thread
From: Steve Kargl @ 2007-07-26 17:40 UTC (permalink / raw)
  To: Daniel Franke; +Cc: fortran, gcc-patches

On Thu, Jul 26, 2007 at 07:11:03PM +0200, Daniel Franke wrote:
> On Thursday 26 July 2007 19:00:57 Steve Kargl wrote:
> > This probably qualifies as "obviously correct", but it someone
> > would cast an eye of the patch I'd appreciate it.
> 
> as the one who caused this regression, I think it looks ok.
> 
> One note: there is logical_comp.f90 in the testsuite which already includes 
> these tests.
> 

logical_comp.f90 has been passing since it was committed.

program foo
  logical :: b
  b = b .eq. b  ! { dg-error ".eqv. instead of .eq." }
  b = b .ne. b  ! { dg-error ".neqv. instead of .ne." }
end program

I wonder if the dot in the strings are being matched as
regular expressions because the "b = b .eq. b" case 
prints ".neqv. instead of .eq." without the patch.  I'll
update the dg-error strings, retest, and commit.

-- 
Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-07-26 17:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-26 17:27 [PATCH,fortran] Fix logical comparison diagnostic message Steve Kargl
2007-07-26 17:34 ` Daniel Franke
2007-07-26 17:40   ` Steve Kargl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).