Calling Fortran final subroutine

Here’s the output I get from NAG (7.1):

 entering
 ctor1
 destructor1 called 0
 destructor1 called 1
 ctor2
 destructor2 called 0
 destructor1 called 0
 destructor2 called 2
 destructor1 called 2
 exit

Which is correct (I believe).

On line obj1 = ObjectDerived(), the constructor is called, the lhs (obj1) is finalized, the assignment is performed and then the rhs is finalized. Then on line obj2 = ObjectDerivedWithDummyFinal(), the constructor is called, the lhs (obj2) is finalized, which involves calling destructor2 then destructor1, and then the rhs is finalized.

With gfortran (13.2) I get:

 entering
 destructor1 called       32645
 ctor1
 destructor1 called           0
 destructor2 called   335544320
 destructor1 called   335544320
 ctor2
 destructor2 called           0
 destructor1 called           0
 exit

Which in this case would be valid to call the finalizer for the lhs before evaluating the rhs, but is not valid in the general case (i.e. if the lhs appears on the rhs). I’m not sure why the assigned value from the constructor doesn’t get propagated through to the finalization of the rhs though.

Is there a reason you would expect something different?