public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "neil.n.carlson at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/45786] New: Relational operators .eq. and == are not recognized as equivalent
Date: Fri, 24 Sep 2010 23:45:00 -0000	[thread overview]
Message-ID: <bug-45786-4@http.gcc.gnu.org/bugzilla/> (raw)

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45786

           Summary: Relational operators .eq. and == are not recognized as
                    equivalent
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: neil.n.carlson@gmail.com


The first paragraph of 7.2 in the standard states that "The operators <, ...
always have the same interpretations as the operators .LT., ..."  Consider the
following example:

module foo_type
  private
  public :: foo, operator(==)
  type :: foo
    integer :: bar
  end type
  interface operator(.eq.)
    module procedure eq_foo
  end interface
contains
  logical function eq_foo (a, b)
    type(foo), intent(in) :: a, b
    eq_foo = (a%bar == b%bar)
  end function
end module

subroutine use_it (a, b)
  use foo_type
  type(foo) :: a, b
  print *, a == b
end subroutine

The compiler incorrectly complains (essentially) that it has no == operator for
the operands when in fact it should -- it appears that the defined .EQ.
operator is not being treated as the same as == in the module.  Here's the
compiler error:

  print *, a == b
          1
Error: Operands of comparison operator '==' at (1) are TYPE(foo)/TYPE(foo)

-- 
Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


             reply	other threads:[~2010-09-24 23:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-24 23:45 neil.n.carlson at gmail dot com [this message]
2010-09-25  0:27 ` [Bug fortran/45786] " kargl at gcc dot gnu.org
2010-09-25  0:35 ` neil.n.carlson at gmail dot com
2010-09-25  5:57 ` sgk at troutmask dot apl.washington.edu
2010-09-25  6:51 ` sgk at troutmask dot apl.washington.edu
2010-10-03 12:21 ` fxcoudert at gcc dot gnu.org
2010-12-16  0:26 ` dfranke at gcc dot gnu.org
2011-05-28 19:21 ` neil.n.carlson at gmail dot com
2011-05-28 22:02 ` tkoenig at gcc dot gnu.org
2011-05-29 13:18 ` [Bug fortran/45786] [4.5/4.6/4.7 Regression] " tkoenig at gcc dot gnu.org
2011-05-29 18:52 ` tkoenig at gcc dot gnu.org
2011-05-30 17:54 ` [Bug fortran/45786] [4.5/4.6 " tkoenig at gcc dot gnu.org
2011-05-31 21:39 ` tkoenig at gcc dot gnu.org
2011-05-31 22:04 ` [Bug fortran/45786] [4.5 " tkoenig at gcc dot gnu.org
2011-06-02  9:10 ` tkoenig at gcc dot gnu.org
2011-06-02  9:12 ` tkoenig at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-45786-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).