https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80524
Bug ID: 80524 Summary: Problematic behaviour with a finalization subroutine in gfortran Product: gcc Version: 6.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: andrew at fluidgravity dot co.uk Target Milestone: --- Created attachment 41268 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41268&action=edit Fortran code with a finalize subroutine When I compile and run the attached code, the subroutine 't_final' gets called once. > gfortran prog.f90 && ./a.out In SUBROUTINE t_final The PGI compiler gives the same behaviour. However, 't_final' is called three times when the Intel (v17.0.1) compiler is used: > ifort prog.f90 && ./a.out In SUBROUTINE t_final In SUBROUTINE t_final In SUBROUTINE t_final I initially assumed that Intel was wrong and sent them a bug report. (It's out-voted and the behaviour is unintuitive.) However, Intel claim that their behaviour is correct. I shall post Intel's response in a follow-up message.