[PATCH, committed] Fortran: fix frontend memory leaks for ALLOCATE with SOURCE [PR109010]

Harald Anlauf anlauf@gmx.de
Sun Sep 21 20:07:51 GMT 2025


Dear All,

the attached obvious patch fixes frontend memleaks for trivial code such
as

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

which showed 4(!) references to __gmp_default_allocate when running f951
under valgrind.  For ALLOCATE, component expr3 of the SOURCE expression
was the culprit.

Regtested clean on x86_64-pc-linux-gnu.

Pushed as r16-4013-g518ec01b363ba7 .

Thanks,
Harald

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fortran-fix-frontend-memory-leaks-for-ALLOCATE-with-.patch
Type: text/x-patch
Size: 1143 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20250921/bc80735e/attachment-0002.bin>


More information about the Fortran mailing list