public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Damian Rouson <rouson@lbl.gov>
To: fortran@gcc.gnu.org
Cc: Wileam Yonatan Phan <wileamyp@gmail.com>,
	Brad Richardson <brad@archaeologic.codes>
Subject: PR 105542 - [F03] Orthogonal standard-conforming type finalization tests
Date: Mon, 9 May 2022 22:28:14 -0700	[thread overview]
Message-ID: <CAM2rSoWLGz03XKCy8r3atG8sg+nGy3quwvXm1iFZsBmePS7iCA@mail.gmail.com> (raw)

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

                 reply	other threads:[~2022-05-10  5:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAM2rSoWLGz03XKCy8r3atG8sg+nGy3quwvXm1iFZsBmePS7iCA@mail.gmail.com \
    --to=rouson@lbl.gov \
    --cc=brad@archaeologic.codes \
    --cc=fortran@gcc.gnu.org \
    --cc=wileamyp@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).