https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106817

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Mikael Morin
<mik...@gcc.gnu.org>:

https://gcc.gnu.org/g:b394ebd90e1f9c125216c70beedf97d6d8739773

commit r10-11029-gb394ebd90e1f9c125216c70beedf97d6d8739773
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Sat Sep 3 11:58:47 2022 +0200

    fortran: Move clobbers after evaluation of all arguments [PR106817]

    For actual arguments whose dummy is INTENT(OUT), we used to generate
    clobbers on them at the same time we generated the argument reference
    for the function call.  This was wrong if for an argument coming
    later, the value expression was depending on the value of the just-
    clobbered argument, and we passed an undefined value in that case.

    With this change, clobbers are collected separatedly and appended
    to the procedure call preliminary code after all the arguments have been
    evaluated.

            PR fortran/106817

    gcc/fortran/ChangeLog:

            * trans-expr.c (gfc_conv_procedure_call): Collect all clobbers
            to their own separate block.  Append the block of clobbers to
            the procedure preliminary block after the argument evaluation
            codes for all the arguments.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/intent_optimize_4.f90: New test.

    (cherry picked from commit 29919bf3b6449bafd02e795abbb1966e3990c1fc)

Reply via email to