Bug 32899 - [4.3 regression] Broken diagnostic for invalid use of .eq. for logicals
Summary: [4.3 regression] Broken diagnostic for invalid use of .eq. for logicals
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.3.0
Assignee: kargls
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2007-07-25 22:19 UTC by Volker Reichelt
Modified: 2007-12-02 22:39 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-07-25 23:57:31


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2007-07-25 22:19:01 UTC
Mainline produces a bad diagnostic for the following code snippet:

===========================
       subroutine FOO
         logical I
         I = I .eq. I
       end subroutine
===========================

ePR22503.f:3.13:

         I = I .eq. I                                                   
            1
Error: Logicals at (1) must be compared with .neqv. instead of .eq.

This should read ".eqv." instead of ".neqv.".

The regression was caused by the following patch:

2007-07-08  Daniel Franke  <franke.daniel@gmail.com>
	    Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>

	PR fortran/17711
	* gfortran.h (gfc_intrinsic_op): Added INTRINSIC_EQ_OS,
	INTRINSIC_NE_OS, INTRINSIC_GT_OS, INTRINSIC_GE_OS, 
	INTRINSIC_LT_OS and INTRINSIC_LE_OS.
        ...

The problem is in the following code snipppet from the function
resolve_operator in resolve.c:

      ...
      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));
      else
      ...

Instead of only testing for INTRINSIC_EQ there should also be a test for
INTRINSIC_EQ_OS IMHO.
Comment 1 kargls 2007-07-25 23:57:31 UTC
Confirmed.

Volker's suggestion is the correct fix.  I have a patch
and test case.  I'm regression testing I as I type.
Comment 2 Daniel Franke 2007-07-26 08:14:52 UTC
Thanks Steve :)
Comment 3 kargls 2007-07-27 16:59:42 UTC
Subject: Bug 32899

Author: kargl
Date: Fri Jul 27 16:59:32 2007
New Revision: 126985

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126985
Log:
2007-07-26  Steven G. Kargl  <kargl@gcc.gnu.org>

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

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

	PR fortran/32899
	* gfortran.dg/logical_comp.f90: Update dg-error strings.


Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/logical_comp.f90

Comment 4 kargls 2007-07-27 17:00:35 UTC
Fixed on trunk.