public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/95647] New: operator(.eq.) and operator(==) treated differently
@ 2020-06-11 21:14 longb at cray dot com
  2020-06-11 21:49 ` [Bug fortran/95647] " dominiq at lps dot ens.fr
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: longb at cray dot com @ 2020-06-11 21:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95647

            Bug ID: 95647
           Summary: operator(.eq.) and operator(==) treated differently
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: longb at cray dot com
  Target Milestone: ---

> cat test.f90
     program test
              use, intrinsic :: ieee_arithmetic, only :                 &
     &                ieee_class,                                       &
     &                ieee_class_type,                                  &
     &                ieee_negative_normal,                             &
     &                ieee_positive_normal,                             &
     &                operator(.eq.)

!             use, intrinsic :: ieee_arithmetic

              real(4) r4
              type(ieee_class_type) class1
              r4 = 1.0
              class1 = ieee_class(r4)
              if (class1 .eq. ieee_positive_normal) print *, 'yes'
              r4 = -1.0
              class1 = ieee_class(r4)
              if (class1 .eq. ieee_negative_normal) print *, 'yes'
      end program test



Try test.f90 with 3 compilers:

> ftn test.f90
 ./a.out
yes
yes
> module swap PrgEnv-cray PrgEnv-intel
> ifort test.f90
> ./a.out
yes
yes
> module swap PrgEnv-intel PrgEnv-gnu
> gfortran test.f90
test.f90:6:43:

6 | & ieee_positive_normal, &
1
Error: Intrinsic operator '.eq.' referenced at (1) not found in module
'ieee_arithmetic'
test.f90:13:18:

13 | if (class1 .eq. ieee_positive_normal) print *, 'yes'
1
Error: Operands of comparison operator '.eq.' at (1) are
TYPE(ieee_class_type)/TYPE(ieee_class_type)
test.f90:16:18:

16 | if (class1 .eq. ieee_negative_normal) print *, 'yes'
1
Error: Operands of comparison operator '.eq.' at (1) are
TYPE(ieee_class_type)/TYPE(ieee_class_type)



Alternate test case:



> diff test.f90 test1.f90

7c7

<      &                operator(.eq.)

---

>      &                operator(==)





Works better:

> ftn test1.f90
> ./a.out
yes
yes
> module swap PrgEnv-cray PrgEnv-intel
> ifort test1.f90
> ./a.out
yes
yes
> module swap PrgEnv-intel PrgEnv-gnu
> gfortran test1.f90
> ./a.out
yes
yes



Referencing .eq. or == should have the same effect.

Curiously, the case that works is the one where the USE ONLY clause specifies
operator(==) and the statements that reference that operator are written using
.eq.

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

end of thread, other threads:[~2021-02-13 21:44 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-11 21:14 [Bug fortran/95647] New: operator(.eq.) and operator(==) treated differently longb at cray dot com
2020-06-11 21:49 ` [Bug fortran/95647] " dominiq at lps dot ens.fr
2020-06-11 22:50 ` kargl at gcc dot gnu.org
2020-06-13  8:11 ` tkoenig at gcc dot gnu.org
2020-06-13 16:16 ` sgk at troutmask dot apl.washington.edu
2021-01-22 17:53 ` longb at cray dot com
2021-02-07 16:35 ` jvdelisle at charter dot net
2021-02-07 17:04 ` longb at cray dot com
2021-02-07 17:55 ` jvdelisle at charter dot net
2021-02-08  0:30 ` kargl at gcc dot gnu.org
2021-02-09  4:46 ` jvdelisle at charter dot net
2021-02-12 15:58 ` cvs-commit at gcc dot gnu.org
2021-02-12 21:05 ` cvs-commit at gcc dot gnu.org
2021-02-13 21:44 ` jvdelisle 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).