https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80524
--- Comment #1 from Andrew Wood <andrew at fluidgravity dot co.uk> --- Intel's response: Hello Andrew, Our development team investigated the issue and determined the following: --------------- Finalization is a tricky thing - there are many different events that trigger a call to a finalizer. Although it may not seem so at first, this program *should* call the finalizer 3 times, not once. The first finalization occurs as a result of this line of code: u = new_t() Here, 'u' is finalized as a result of the following text from the F2008 standard: "When an intrinsic assignment statement is executed, the variable is finalized after evaluation of expr and before the definition of the variable." 'Variable' in this line of code is 'u'. Since this is an intrinsic assignment statement, 'u' is the first object to be finalized. The second finalization occurs because of the same line of user code, but this time it's the result of 'new_t' that is finalized according to the following text: " If an executable construct references a function, the result is finalized after execution of the innermost executable construct containing the reference." Because of this rule, the result of the call to 'new_t' is finalized next. The third finalization occurs at the end of routine 's'. The standard says: "A nonpointer, nonallocatable object that is not a dummy argument or function result is finalized immediately before it would become undefined due to execution of a RETURN or END statement" The variable 'u' is a nonpointer, nonallocatable object that is not a dummy argument or function result, so it is finalized at the end of the routine 's'. So the three calls to the finalizer are correct and the results from PGI Fortran are incorrect. ------------------- Since this is not a Intel Fortran Compiler defect, I am closing this case. Do not hesitate to contact me if you have any other questions or need further assistance with Intel® Software Development Products. Thank you for contacting Intel® Online Service Center, Devorah Intel® Developer Support