]> gcc.gnu.org Git - gcc.git/commit
Fortran: overloading of intrinsic binary operators [PR109641]
authorHarald Anlauf <anlauf@gmx.de>
Fri, 5 May 2023 19:22:12 +0000 (21:22 +0200)
committerHarald Anlauf <anlauf@gmx.de>
Fri, 5 May 2023 19:22:12 +0000 (21:22 +0200)
commit185da7c2014ba41f38dd62cc719873ebf020b076
treeda3714c540a770495b5aef35085a3c23e1891ecf
parent0c1eaac3fd35eafedc8fb5638af30af0aea199d3
Fortran: overloading of intrinsic binary operators [PR109641]

Fortran allows overloading of intrinsic operators also for operands of
numeric intrinsic types.  The intrinsic operator versions are used
according to the rules of F2018 table 10.2 and imply type conversion as
long as the operand ranks are conformable.  Otherwise no type conversion
shall be performed to allow the resolution of a matching user-defined
operator.

gcc/fortran/ChangeLog:

PR fortran/109641
* arith.cc (eval_intrinsic): Check conformability of ranks of operands
for intrinsic binary operators before performing type conversions.
* gfortran.h (gfc_op_rank_conformable): Add prototype.
* resolve.cc (resolve_operator): Check conformability of ranks of
operands for intrinsic binary operators before performing type
conversions.
(gfc_op_rank_conformable): New helper function to compare ranks of
operands of binary operator.

gcc/testsuite/ChangeLog:

PR fortran/109641
* gfortran.dg/overload_5.f90: New test.
gcc/fortran/arith.cc
gcc/fortran/gfortran.h
gcc/fortran/resolve.cc
gcc/testsuite/gfortran.dg/overload_5.f90 [new file with mode: 0644]
This page took 0.059206 seconds and 5 git commands to generate.