public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* PR 105542 - [F03] Orthogonal standard-conforming type finalization tests
@ 2022-05-10  5:28 Damian Rouson
  0 siblings, 0 replies; only message in thread
From: Damian Rouson @ 2022-05-10  5:28 UTC (permalink / raw)
  To: fortran; +Cc: Wileam Yonatan Phan, Brad Richardson

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.  Thanks to the contributions of Wileam Phan and Brad Richardson,
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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-10  5:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10  5:28 PR 105542 - [F03] Orthogonal standard-conforming type finalization tests Damian Rouson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).