[Bug fortran/65454] New: Extending both forms of relational operators
wxcvbn789456123-nw6wda at yahoo dot fr
gcc-bugzilla@gcc.gnu.org
Tue Mar 17 16:00:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65454
Bug ID: 65454
Summary: Extending both forms of relational operators
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: wxcvbn789456123-nw6wda at yahoo dot fr
Extending both forms of relational operators
Dear Sirs,
The F2008 Working Document, J3/12-007, states in 12.4.3.4.2 Defined operations:
"Because both forms of each relational operator have the same interpretation
(7.1.6.2), extending one form (such as <=) has the effect of defining both
forms (<= and .LE.)."
However, the following program does not compile with gfortran.
This problem does not occur with ifort.
Operating system = Microsoft Windows 7 SP1
gfortran: provided by cygwin
Example under a Cygwin session:
bash 1 : uname -smo
CYGWIN_NT-6.1-WOW i686 Cygwin
bash 2 : gfortran --version | head -3
GNU Fortran (GCC) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
bash 3 : cat oper.f90
MODULE deriv_m
IMPLICIT NONE
TYPE deriv_t
INTEGER :: i
END TYPE deriv_t
INTERFACE OPERATOR (<=)
MODULE PROCEDURE :: deriv_LE_deriv
END INTERFACE OPERATOR (<=)
CONTAINS
ELEMENTAL FUNCTION deriv_LE_deriv (a, b) RESULT (c)
TYPE(deriv_t), INTENT(IN) :: a, b
LOGICAL :: c
c = a%i .LE. b%i
END FUNCTION deriv_LE_deriv
END MODULE deriv_m
PROGRAM oper
USE :: deriv_m, ONLY: deriv_t, OPERATOR(.LE.)
IMPLICIT NONE
TYPE(deriv_t) :: one = deriv_t(1), two = deriv_t(2)
WRITE (*,'(A,L1)') '(one <= two) = ', one <= two
WRITE (*,'(A,L1)') '(one .LE. two) = ', one .LE. two
END PROGRAM oper
bash 4 : gfortran oper.f90 -o g.exe
oper.f90:19.33:
USE :: deriv_m, ONLY: deriv_t, OPERATOR(.LE.)
1
Error: Intrinsic operator '.le.' referenced at (1) not found in module
'deriv_m'
oper.f90:22.42:
WRITE (*,'(A,L1)') '(one <= two) = ', one <= two
1
Error: Operands of comparison operator '<=' at (1) are
TYPE(deriv_t)/TYPE(deriv_t)
oper.f90:23.42:
WRITE (*,'(A,L1)') '(one .LE. two) = ', one .LE. two
1
Error: Operands of comparison operator '.le.' at (1) are
TYPE(deriv_t)/TYPE(deriv_t)
bash 5 : ifort /nologo oper.f90 /exe:i.exe
bash 6 : ./i.exe
(one <= two) = T
(one .LE. two) = T
Can this behavior be considered as a bug?
Greetings
Paul
More information about the Gcc-bugs
mailing list