]> git.ipfire.org Git - thirdparty/gcc.git/commit
fortran: Fix invalid function decl clobber ICE [PR105012]
authorMikael Morin <mikael@gcc.gnu.org>
Mon, 29 Aug 2022 09:19:29 +0000 (11:19 +0200)
committerMikael Morin <mikael@gcc.gnu.org>
Sun, 25 Sep 2022 12:44:53 +0000 (14:44 +0200)
commitedaf1e005c90b311c39b46d85cea17befbece112
treef86ab7657d2735c7f2516afdee5ca0ef58b8f29b
parent2b393f6f83903cb836676bbd042c1b99a6e7e6f7
fortran: Fix invalid function decl clobber ICE [PR105012]

The fortran frontend, as result symbol for a function without
declared result symbol, uses the function symbol itself.  This caused
an invalid clobber of a function decl to be emitted, leading to an
ICE, whereas the intended behaviour was to clobber the function result
variable.  This change fixes the problem by getting the decl from the
just-retrieved variable reference after the call to
gfc_conv_expr_reference, instead of copying it from the frontend symbol.

PR fortran/105012

gcc/fortran/ChangeLog:

* trans-expr.cc (gfc_conv_procedure_call): Retrieve variable
from the just calculated variable reference.

gcc/testsuite/ChangeLog:

* gfortran.dg/intent_out_15.f90: New test.
gcc/fortran/trans-expr.cc
gcc/testsuite/gfortran.dg/intent_out_15.f90 [new file with mode: 0644]