]> git.ipfire.org Git - thirdparty/gcc.git/commit
fortran: Correctly evaluate scalar MASK arguments of MINLOC/MAXLOC
authorMikael Morin <mikael@gcc.gnu.org>
Sat, 13 Jul 2024 18:21:20 +0000 (20:21 +0200)
committerMikael Morin <mikael@gcc.gnu.org>
Sat, 13 Jul 2024 18:21:20 +0000 (20:21 +0200)
commitd211100903d4d532d989451243ea00d7fa2e9d5e
treeecbad1149968bdc11f7e36616a05b67faae86fdc
parent6fc24a022218c9017e0ee2a9f2913ef85609c265
fortran: Correctly evaluate scalar MASK arguments of MINLOC/MAXLOC

Add the preliminary code that the generated expression for MASK may depend
on when generating the inline code to evaluate MINLOC or MAXLOC with a
scalar MASK.

The generated code was only keeping the generated expression but not the
preliminary code, which was sufficient for simple cases such as data
references or simple (scalar) function calls, but was bogus with more
complicated ones.

gcc/fortran/ChangeLog:

* trans-intrinsic.cc (gfc_conv_intrinsic_minmaxloc): Add the
preliminary code generated for MASK to the preliminary code of
MINLOC/MAXLOC.

gcc/testsuite/ChangeLog:

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