]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: fix frontend memory leaks for ALLOCATE with SOURCE [PR109010]
authorHarald Anlauf <anlauf@gmx.de>
Sun, 21 Sep 2025 19:54:44 +0000 (21:54 +0200)
committerHarald Anlauf <anlauf@gmx.de>
Sun, 21 Sep 2025 19:54:44 +0000 (21:54 +0200)
commit518ec01b363ba782fe9a9b09a05a2716cedf8b01
tree47d64611df204eaca7f94d6490e7805030923963
parent058b2ef951fa833145891834471c7e577b72221f
Fortran: fix frontend memory leaks for ALLOCATE with SOURCE [PR109010]

When running under valgrind the Fortran frontend showed several leaks
involving __gmp_default_allocate for simple code such as

  program p
    real, pointer :: x(:)
    allocate (x, source = reshape ([1.], [1]))
  end

as not all used components of the structure gfc_code were freed when a
statement was freed.  Just do so.

PR fortran/109010

gcc/fortran/ChangeLog:

* st.cc (gfc_free_statement): Also free components expr3 and expr4.
gcc/fortran/st.cc