Thomas Koenig
2018-09-22 17:23:20 UTC
Hello world,
the attached patch lets the middle-end know that variables
associated with intent(out) arguments become undefined, by
issuing an assignment to a special value (a "clobber")
before entering the procedure.
Originally, I had also planned to do so on entry to the
procedure, see https://gcc.gnu.org/ml/fortran/2018-09/msg00148.html .
This turned out to cause regressions; some details are outlined
in the PR.
Regression-tested. OK for trunk?
Regards
Thomas
2018-09-22 Thomas Koenig <***@gcc.gnu.org>
PR fortran/41453
* trans.h (gfc_conv_expr_reference): Add optional argument
add_clobber to prototype.
(gfc_conv_procedure_call): Set add_clobber argument to
gfc_conv_procedure_reference to true for scalar, INTENT(OUT),
non-pointer, non-allocatable, non-dummy variables whose type
is neither BT_CHARACTER, BT_DERIVED or BT_CLASS, but only if
the procedure is not elemental.
* trans-expr.c (gfc_conv_procedure_reference): Add clobber
statement before call if add_clobber is set.
2018-09-22 Thomas Koenig <***@gcc.gnu.org>
PR fortran/41453
* gfortran.dg/intent_optimize_2.f90: New test.
the attached patch lets the middle-end know that variables
associated with intent(out) arguments become undefined, by
issuing an assignment to a special value (a "clobber")
before entering the procedure.
Originally, I had also planned to do so on entry to the
procedure, see https://gcc.gnu.org/ml/fortran/2018-09/msg00148.html .
This turned out to cause regressions; some details are outlined
in the PR.
Regression-tested. OK for trunk?
Regards
Thomas
2018-09-22 Thomas Koenig <***@gcc.gnu.org>
PR fortran/41453
* trans.h (gfc_conv_expr_reference): Add optional argument
add_clobber to prototype.
(gfc_conv_procedure_call): Set add_clobber argument to
gfc_conv_procedure_reference to true for scalar, INTENT(OUT),
non-pointer, non-allocatable, non-dummy variables whose type
is neither BT_CHARACTER, BT_DERIVED or BT_CLASS, but only if
the procedure is not elemental.
* trans-expr.c (gfc_conv_procedure_reference): Add clobber
statement before call if add_clobber is set.
2018-09-22 Thomas Koenig <***@gcc.gnu.org>
PR fortran/41453
* gfortran.dg/intent_optimize_2.f90: New test.