https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94361
anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Known to work| |6.5.0, 7.2.0, 7.4.0, 8.1.0 Target Milestone|--- |8.5 Summary|Memory leak in nested types |[8/9/10/11 Regression] |with final |Memory leak in nested types | |with final Known to fail| |9.2.0 --- Comment #4 from anlauf at gcc dot gnu.org --- (In reply to Antony Lewis from comment #3) > On Windows 8.1.0 does not leak, and on NERSC 8.3.0 20190222 (Cray Inc.) also > does not (but 9.2.0 does)... so not exactly sure what this means about when > it was introduced. So adding to known-to-work/fail. I found a Debian machine with 7.2.0 and compared the dump tree with that of 7.4.1. There is clearly a chunk of code related to finalization present in 7.2.0, but it is missing in 7.4.1: if (&ptr2->t != 0B) { { integer(kind=4) stat.5; if ((real(kind=4)[0:] * restrict) ptr2->t.dat.data == 0B) { stat.5 = 1; } else { __builtin_free (ptr2->t.dat.data); (real(kind=4)[0:] * restrict) ptr2->t.dat.data = 0B; stat.5 = 0; } if (stat.5 != 0) goto L.9; L.9:; ignore = stat.5; } } L.8:; { struct array0_typewithfinal desc.6; desc.6.dtype = 40; desc.6.data = (void * restrict) &ptr2->t.x; __final_debug_Typewithfinal (&desc.6); } Looking at the changes to the 7 series leading to 7.4.1 might indicate the which commit (or backport) caused this. Marking as (7)/8/9/10/11 regression.