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

            Bug ID: 105542
           Summary: [F03] Orthogonal standard-conforming type finalization
                    tests
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: damian at archaeologic dot codes
  Target Milestone: ---

In case it's useful to gfortran developers, the Reference-Counter repository
(https://github.com/sourceryinstitute/reference-counter) contains a
test/compiler_test.f90 file that separately tests each of the scenarios in
which Fortran 2018 clause 7.5.6.3 requires type finalization to occur.  One
function tests each scenario.  A comment near the top of each such function
cites the paragraph number of the corresponding requirement.  To download and
run the tests on macOS or Linux with gfortran 12.1.0 and the Fortran Package
Manager (fpm) already installed, execute the following commands:

git clone https://github.com/sourceryinstitute/reference-counter
cd reference-counter
fpm test

for which the trailing output is


Running Tests

Test that
    The compiler
        finalizes a non-allocatable object on the LHS of an intrinsic
assignment
        finalizes an allocated allocatable LHS of an intrinsic assignment
        finalizes a target when the associated pointer is deallocated
        finalizes an object upon explicit deallocation
        finalizes a non-pointer non-allocatable array object at the END
statement
        finalizes a non-pointer non-allocatable object at the end of a block
construct
        finalizes a function reference on the RHS of an intrinsic assignment
        finalizes a specification expression function result
        finalizes an intent(out) derived type dummy argument
        finalizes an allocatable component object
    A ref_reference
        does not leak when constructed, assigned, and then explicitly freed

A total of 11 test cases

Failed
Took 1.94e-4 seconds

Test that
    The compiler
        finalizes a non-allocatable object on the LHS of an intrinsic
assignment
            Expected
                    |1|
                but got
                    |0|
        finalizes an allocated allocatable LHS of an intrinsic assignment
            Expected
                    |1|
                but got
                    |0|
        finalizes a function reference on the RHS of an intrinsic assignment
            Expected
                    |1|
                but got
                    |0|
        finalizes a specification expression function result
            Expected
                    |1|
                but got
                    |0|

4 of 11 cases failed
4 of 11 assertions failed

STOP 1
<ERROR> Execution failed for object " reference-counter-test "
<ERROR>*cmd_run*:stopping due to failed executions
STOP 1
  • [Bug fortran/10554... damian at archaeologic dot codes via Gcc-bugs

Reply via email to