[Bug fortran/94109] Memory leak introduced in 8.3.0->8.3.1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94109 Thomas Koenig changed: What|Removed |Added Status|WAITING |NEW --- Comment #13 from Thomas Koenig --- Confirmed, then. Thanks for reducing this!
[Bug fortran/94109] Memory leak introduced in 8.3.0->8.3.1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94109 --- Comment #12 from Antony Lewis --- Valgrid report is HEAP SUMMARY: ==23446== in use at exit: 40,000 bytes in 1 blocks ==23446== total heap usage: 26 allocs, 25 frees, 93,657 bytes allocated ==23446== ==23446== 40,000 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==23446==at 0x483577F: malloc (vg_replace_malloc.c:299) ==23446==by 0x402052: __debug_MOD_leaker (bug.f90:21) ==23446==by 0x4021DA: MAIN__ (bug.f90:32) ==23446==by 0x402211: main (bug.f90:30) ==23446== ==23446== LEAK SUMMARY: ==23446==definitely lost: 40,000 bytes in 1 blocks ==23446==indirectly lost: 0 bytes in 0 blocks ==23446== possibly lost: 0 bytes in 0 blocks ==23446==still reachable: 0 bytes in 0 blocks ==23446== suppressed: 0 bytes in 0 blocks
[Bug fortran/94109] Memory leak introduced in 8.3.0->8.3.1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94109 --- Comment #11 from Antony Lewis --- It took ages to narrow this down, but here's a simple test case that still gives a leak with valgrind in gcc-8 HEAD, 8.4.0, 9.3.0 (OK with 7.4.0) module debug implicit none Type Tester real, dimension(:), allocatable :: Dat, Dat2 end Type Type TestType2 Type(Tester) :: T end type TestType2 contains subroutine Leaker class(TestType2), pointer :: ActiveState Type(Tester) :: Temp allocate(Temp%Dat2(1)) allocate(TestType2::ActiveState) ActiveState%T = Temp deallocate(ActiveState) end subroutine end module program run use debug call Leaker() end program
[Bug fortran/94109] Memory leak introduced in 8.3.0->8.3.1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94109 --- Comment #10 from Thomas Koenig --- (In reply to Dominique d'Humieres from comment #9) > Is it a false positive or not? You probably need a higher optimization level with -fanalyzer, it doesn't show anything at -O. Nor does valgrind show anything. So, I'd say a false positive.
[Bug fortran/94109] Memory leak introduced in 8.3.0->8.3.1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94109 --- Comment #9 from Dominique d'Humieres --- For the record: % gfc pr94361.f90 -fanalyzer pr94361.f90:24:0: 24 | end subroutine | Warning: leak of 'test.t.dat.data' [CWE-401] [-Wanalyzer-malloc-leak] 'leaker': events 1-11 | | 20 | subroutine Leaker | | |.. | 23 | allocate(Test%T%Dat(1)) | | | 24 | end subroutine | | | +--> '__final_debug_Testtype2': events 12-30 | | 30 | end module | | ~ | | | | | (18) state of 'test.t.dat.data': 'start' -> 'nonnull' (origin: NULL) | | (19) state of 'test.t.dat.data': 'start' -> 'nonnull' (origin: NULL) | | (20) state of 'test.t.dat.data': 'start' -> 'nonnull' (origin: NULL) | | (21) following 'true' branch... | | (24) state of 'test.t.dat.data': 'start' -> 'nonnull' (origin: NULL) | | (25) state of 'test.t.dat.data': 'start' -> 'nonnull' (origin: NULL) | | (26) state of 'test.t.dat.data': 'start' -> 'nonnull' (origin: NULL) | | (27) following 'true' branch... | '__final_debug_Testtype2': events 31-32 | f951: | (31): state of 'test.t.dat.data': 'start' -> 'nonnull' (origin: NULL) | (32): state of 'test.t.dat.data': 'start' -> 'nonnull' (origin: NULL) | '__final_debug_Testtype2': event 33 | f951: | (33): state of 'test.t.dat.data': 'start' -> 'nonnull' (origin: NULL) | '__final_debug_Testtype2': events 34-35 | | 30 | end module | | | <--+ | 'leaker': events 36-37 | | 24 | end subroutine | | | Is it a false positive or not?
[Bug fortran/94109] Memory leak introduced in 8.3.0->8.3.1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94109 --- Comment #8 from Thomas Koenig --- Unfortunately, without a somewhat reduced test case, there is not a lot I can do :-( Could you run this under valgrind, pinpoint the memory leaks (somewhat) and then try to reduce this?
[Bug fortran/94109] Memory leak introduced in 8.3.0->8.3.1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94109 --- Comment #7 from Antony Lewis --- However the reduced case of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94361 now seems to be OK. However on trunk, the fix for 94361 seems to have introduced a leak that was not there before: https://travis-ci.org/github/cmbant/CAMB/jobs/692470383 (was fine from gcc source build from 5 days ago - I just reran it with the new docker image)
[Bug fortran/94109] Memory leak introduced in 8.3.0->8.3.1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94109 --- Comment #6 from Antony Lewis --- Thanks for looking in to it. I tried rebuilding my gcc8 docker and rerunning. It now reports GNU Fortran (GCC) 8.4.1 20200602, however the leak still seems to be there? https://travis-ci.org/github/cmbant/CAMB/jobs/660297689
[Bug fortran/94109] Memory leak introduced in 8.3.0->8.3.1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94109 --- Comment #5 from Thomas Koenig --- So, fixed with the patch for PR 94109?
[Bug fortran/94109] Memory leak introduced in 8.3.0->8.3.1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94109 --- Comment #4 from Antony Lewis --- Not sure why no one has at least picked up on https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94361 since it is a reproducible regression with a simple test case, an a bug that effectively kills some previously-working code from 7.x updates onwards?
[Bug fortran/94109] Memory leak introduced in 8.3.0->8.3.1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94109 --- Comment #3 from Antony Lewis --- Although my reduced test in the other id case is one problem, it appears that is not the only memory leak. Someone tested else on various gcc versions and still found: versionmemory leak 7.3.0 no 8.2.0 no 7.5.0 yes 8.4.0 yes 9.2.0 yes 9.3.0 yes So it certainly looks like a regression.
[Bug fortran/94109] Memory leak introduced in 8.3.0->8.3.1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94109 --- Comment #2 from Antony Lewis --- This may be the test case, though I'm not 100% sure: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94361
[Bug fortran/94109] Memory leak introduced in 8.3.0->8.3.1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94109 Thomas Koenig changed: What|Removed |Added CC||tkoenig at gcc dot gnu.org Last reconfirmed||2020-04-11 Ever confirmed|0 |1 Status|UNCONFIRMED |WAITING --- Comment #1 from Thomas Koenig --- Is there a test case?