aboutsummaryrefslogtreecommitdiff
path: root/gcc/gdbhooks.py
diff options
context:
space:
mode:
authorMikael Morin <mikael@gcc.gnu.org>2024-08-02 14:24:34 +0200
committerMikael Morin <mikael@gcc.gnu.org>2024-08-02 18:38:51 +0200
commita10436a8404ad2f0cc5aa4d6a0cc850abe5ef49e (patch)
tree1529b1267ff4f46314e160580bb41795e5376ae4 /gcc/gdbhooks.py
parentda33ad53bcb57943fa671c745938a53f4de89a1b (diff)
downloadgcc-a10436a8404ad2f0cc5aa4d6a0cc850abe5ef49e.zip
gcc-a10436a8404ad2f0cc5aa4d6a0cc850abe5ef49e.tar.gz
gcc-a10436a8404ad2f0cc5aa4d6a0cc850abe5ef49e.tar.bz2
fortran: Support optional dummy as BACK argument of MINLOC/MAXLOC.
Protect the evaluation of BACK with a check that the reference is non-null in case the expression is an optional dummy, in the inline code generated for MINLOC and MAXLOC. This change contains a revert of the non-testsuite part of commit r15-1994-ga55d24b3cf7f4d07492bb8e6fcee557175b47ea3, which factored the evaluation of BACK out of the loop using the scalarizer. It was a bad idea, because delegating the argument evaluation to the scalarizer makes it cumbersome to add a null pointer check next to the evaluation. Instead, evaluate BACK at the beginning, before scalarization, add a check that the argument is present if necessary, and evaluate the resulting expression to a variable, before using the variable in the inline code. gcc/fortran/ChangeLog: * trans-intrinsic.cc (maybe_absent_optional_variable): New function. (gfc_conv_intrinsic_minmaxloc): Remove BACK from scalarization and evaluate it before. Add a check that BACK is not null if the expression is an optional dummy. Save the resulting expression to a variable. Use the variable in the generated inline code. gcc/testsuite/ChangeLog: * gfortran.dg/maxloc_6.f90: New test. * gfortran.dg/minloc_7.f90: New test.
Diffstat (limited to 'gcc/gdbhooks.py')
0 files changed, 0 insertions, 0 deletions