https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60922
--- Comment #7 from janus at gcc dot gnu.org --- Looking at the output of -fdump-tree-original for comment 6, one sees with 4.8: d_vect_bld_x (struct __class_test_leak_D_vect_type & restrict x) { if (x->_data->v._data != 0B) { __builtin_free ((void *) x->_data->v._data); } while trunk shows: d_vect_bld_x (struct __class_test_leak_D_vect_type_t & restrict x) { if (x->_vptr->_final != 0B) { { struct array0_d_vect_type desc.7; desc.7.dtype = 1064; desc.7.data = (void * restrict) x->_data; x->_vptr->_final (&desc.7, x->_vptr->_size, 0); } } That is: In 4.8 the argument x is directly freed when entering the function. On trunk (after the implementation of finalization) the _final routine is called instead. Apparently the latter fails to properly free the allocatable class component.