public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/115072] New: Memory link with unlimited polymorphic function result
@ 2024-05-13 14:44 rnhmjoj at eurofusion dot eu
2024-05-13 17:02 ` [Bug fortran/115072] Memory leak " anlauf at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: rnhmjoj at eurofusion dot eu @ 2024-05-13 14:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115072
Bug ID: 115072
Summary: Memory link with unlimited polymorphic function result
Product: gcc
Version: 13.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: rnhmjoj at eurofusion dot eu
Target Milestone: ---
The following program works as expected, but the result of the id(x) function
does not appear to be ever deallocated creating a memory leak:
program test
print *, transfer(id(7), 1)
contains
pure function id(x) result(y)
class(*), intent(in) :: x
class(*), allocatable :: y
y = x
end function
end program test
Specifically, running the program in valgrind memcheck with --leak-check=full
reveals this:
4 bytes in 1 blocks are definitely lost in loss record 1 of 1
at 0x484276B: malloc (in vgpreload_memcheck-amd64-linux.so)
by 0x401338: id.1 (test.f90:10)
by 0x401243: MAIN__ (test.f90:3)
by 0x401432: main (test.f90:3)
Replacing the `class(*)` with some other type does not produce a leak.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug fortran/115072] Memory leak with unlimited polymorphic function result
2024-05-13 14:44 [Bug fortran/115072] New: Memory link with unlimited polymorphic function result rnhmjoj at eurofusion dot eu
@ 2024-05-13 17:02 ` anlauf at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-05-13 17:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115072
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Memory link with unlimited |Memory leak with unlimited
|polymorphic function result |polymorphic function result
Priority|P3 |P4
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
CC| |anlauf at gcc dot gnu.org
Last reconfirmed| |2024-05-13
--- Comment #1 from anlauf at gcc dot gnu.org ---
Runtime memleak confirmed, also seen with -fsanitize=address .
Affects all versions up to 15-mainline.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-13 17:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-13 14:44 [Bug fortran/115072] New: Memory link with unlimited polymorphic function result rnhmjoj at eurofusion dot eu
2024-05-13 17:02 ` [Bug fortran/115072] Memory leak " anlauf at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).