Hi Mikael,

Am 21.12.21 um 13:38 schrieb Mikael Morin:
Le 20/12/2021 à 23:05, Harald Anlauf via Fortran a écrit :
Dear all,

we need to check the arguments of the elemental MASKL and MASKR
intrinsics also before simplifying.

Testcase by Gerhard.  The fix is almost obvious, but I'm happy to
get feedback in case there is something I overlooked.  (There is
already a check on scalar arguments to MASKL/MASKR, which however
misses the case of array arguments.)

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

Your patch looks reasonable and safe.
However, I find it surprising that it’s actually needed, as gfc_check
mask is already the check function associated to maskl and maskr in the
definition of the symbols.  The simplification function should be called
only when the associated check function has returned successfully, so it
shouldn’t be necessary to call it again at simplification time.
Looking at the backtrace, it is the do_simplify call at the beginning of
  gfc_intrinsic_func_interface that seems dubious to me, as it comes
before all the check further down in the function and it looks redundant
with the other simplification code after the checks.

So I’m inclined to test whether by any chance removing that call works,
and if it doesn’t, let’s go with this patch.

Did you find the time to try your version?

Mikael


Thanks,
Harald

Reply via email to