]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: do not evaluate arguments of MAXVAL/MINVAL too often [PR118613]
authorHarald Anlauf <anlauf@gmx.de>
Wed, 22 Jan 2025 21:44:39 +0000 (22:44 +0100)
committerHarald Anlauf <anlauf@gmx.de>
Thu, 23 Jan 2025 18:09:39 +0000 (19:09 +0100)
commit3cef53a4d4ff44a5b61284bb0e6977f7ba7b3aab
treee6d89cce80946b3c6f6fac0f7a2a85ad7bef0f80
parent0bb3223097e5ced4f9a13d18c6c65f2a9496437e
Fortran: do not evaluate arguments of MAXVAL/MINVAL too often [PR118613]

PR fortran/118613

gcc/fortran/ChangeLog:

* trans-intrinsic.cc (gfc_conv_intrinsic_minmaxval): Adjust algorithm
for inlined version of MINLOC and MAXLOC so that arguments are only
evaluted once, and create temporaries where necessary.  Document
change of algorithm.

gcc/testsuite/ChangeLog:

* gfortran.dg/maxval_arg_eval_count.f90: New test.
gcc/fortran/trans-intrinsic.cc
gcc/testsuite/gfortran.dg/maxval_arg_eval_count.f90 [new file with mode: 0644]