https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104382
--- Comment #1 from Paul Thomas <pault at gcc dot gnu.org> --- (In reply to Paul Thomas from comment #0) > Created attachment 52349 [details] > Testcase for the problems > > With all branches that feature finalization, the attached testcase outputs: > final_count after assignment = 0 > destructor4(complicated) 4.00000000 5.00000000 > destructor5 (simple2) -1 > destructor5 (simple2) -2 > destructor2(simple) 3 4 > final_count after deallocation = 4 > > Ifort, on the other hand, outputs: > destructor4(complicated) 2.000000 2.000000 > destructor5 (simple2) 5 > destructor5 (simple2) 6 > destructor1(simple) 1 > destructor1(simple) 1 > final_count after assignment = 5 > destructor4(complicated) 4.000000 5.000000 > destructor5 (simple2) -1 > destructor5 (simple2) -2 > destructor1(simple) 3 > destructor1(simple) 4 > final_count after deallocation = 10 > > There are two problems: > (i) The finalization of 'var' prior to reallocation is not ocurring. This is > fixed by the patch that I posted to the list yesterday. > > (ii) The parent component is not being treated as a component, as mandated > by F2018 7.5.6.2/1(3). Ifort is behaving correctly. > > Paul I now discover that NAG 7.1 behaves the same way as gfortran. Paul