https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69298

            Bug ID: 69298
           Summary: Array finalisers seem to be given the wrong array when
                    the array is a member variable.
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: matthew.hambley at metoffice dot gov.uk
  Target Milestone: ---

Created attachment 37355
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37355&action=edit
Minimal test case which exhibits problem

The attached example program exhibits the problem.

The basic situation is a type (stuff_type) and an array of that type which are
initialised, some make-work is done and then they go out of scope so are
finalised.

When this is done within a procedure within the program all works as expected.

When this is done within another type (test_type) the array finaliser does not
behave as expected. The array passed to it (which should contain 3 stuff_type
objects containing 1, 2 and 3) appears to contain objects only containing 1.

Compiling this example throws a lot of warnings about a missing scalar
finaliser which is clearly not true. This is a known problem, see 58175.

This example behaves as expected when built using Intel Fortran.

Reply via email to