[PATCH] Fortran: do not evaluate arguments of MAXVAL/MINVAL too often [PR118613]

Harald Anlauf anlauf@gmx.de
Wed Jan 22 21:55:06 GMT 2025


Dear all,

while looking at details of a related but slightly different PR, I found
that we did evaluate the arguments to MINLOC/MAXLOC too often in the
inlined version.

The attached patch creates temporaries for array elements where needed,
and ensures that each array element is only touched once.  This required
a minor adjustment for the rank-1 algorithm, which is documented.

Regtested on x86_64-pc-linux-gnu.  OK for mainline?

Thanks,
Harald

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr118613.diff
Type: text/x-patch
Size: 5633 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20250122/563186b4/attachment-0002.bin>


More information about the Fortran mailing list