]> git.ipfire.org Git - people/ms/gcc.git/commit
fortran: Reuse associated_dummy memory if previously allocated [PR108923]
authorMikael Morin <mikael@gcc.gnu.org>
Sat, 25 Feb 2023 20:37:46 +0000 (21:37 +0100)
committerMikael Morin <mikael@gcc.gnu.org>
Sun, 12 Mar 2023 09:34:37 +0000 (10:34 +0100)
commit7b0c9631ccb492c4457a91dbb91e7a5bcd0bc2a6
tree177cd61a58bc6b5cb74ffb3713923b855e5e050b
parentcd65c727fd6d5a252964dbeb3a735daa0a521a89
fortran: Reuse associated_dummy memory if previously allocated [PR108923]

This avoids making the associted_dummy field point to a new memory chunk
if it's already pointing somewhere, in which case doing so would leak the
previously allocated chunk.

PR fortran/108923

gcc/fortran/ChangeLog:

* intrinsic.cc (get_intrinsic_dummy_arg,
set_intrinsic_dummy_arg): Rename the former to the latter.
Remove the return value, add a reference to the lhs as argument,
and do the pointer assignment inside the function.  Don't do
it if the pointer is already non-NULL.
(sort_actual): Update caller.

(cherry picked from commit 5c638095e7e0fa4de4e4f7326384a86830b25732)
gcc/fortran/intrinsic.cc