public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/45786] New: Relational operators .eq. and == are not recognized as equivalent
@ 2010-09-24 23:45 neil.n.carlson at gmail dot com
  2010-09-25  0:27 ` [Bug fortran/45786] " kargl at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: neil.n.carlson at gmail dot com @ 2010-09-24 23:45 UTC (permalink / raw)
  To: gcc-bugs

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.


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

end of thread, other threads:[~2011-06-02  9:12 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-24 23:45 [Bug fortran/45786] New: Relational operators .eq. and == are not recognized as equivalent neil.n.carlson at gmail dot com
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

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