From: Sandra Loosemore <sandra@codesourcery.com>
To: Tobias Burnus <tobias@codesourcery.com>,
gcc-patches <gcc-patches@gcc.gnu.org>,
fortran <fortran@gcc.gnu.org>
Subject: Re: [Patch] Fortran: Avoid var initialization in interfaces [PR54753]
Date: Sat, 2 Oct 2021 12:01:40 -0600 [thread overview]
Message-ID: <0131e2d5-be68-d3b1-b90f-6640c358e1ab@codesourcery.com> (raw)
In-Reply-To: <40ee9c33-3122-54aa-a43b-655bb280b7fc@codesourcery.com>
On 9/29/21 2:53 AM, Tobias Burnus wrote:
> Found when looking at F2018:C839 / PR54753.
>
> For INTENT(OUT) the dummy variable (might) also be default initialized
> or deallocated. However, with assumed rank, that causes issues, which
> C839 prevents. In the current GCC implementation, missing C839 constraint
> diagnostic, but also rejects-valid/ice-on-valid appears.
>
> There are three issues, this patch solves the first:
>
> * reject-valid issue due to adding the initializer also to a dummy
> argument which is in an INTERFACE block. Having initializers in
> INTERFACE blocks is pointless and causes for the attached testcase
> the bogus error:
> "Assumed-rank variable y at (1) may only be used as actual argument"
>
> (Except for wasting resources and this error, they should be ignored
> in trans*.c and usually do not cause any further harm.)
>
>
> I think Sandra has a nearly ready patch to do the C839 constraint
> diagnostic, which needs the attached patch to do the checks.
>
> The third issue is that GCC currently gives either an ICE or the
> above error message when declaring a procedure with a valid
> assumed-rank intent(out) dummy. This has still to be solved as well.
> But first I wanted to unblock Sandra's C839 work with this patch :-)
This has indeed allowed me to make progress on adding the diagnostic,
but I'm seeing some test regressions on x86_64-linux-gnu that are due to
this patch alone:
FAIL: gfortran.dg/default_initialization_3.f90 -O0 execution test
FAIL: gfortran.dg/default_initialization_3.f90 -O1 execution test
FAIL: gfortran.dg/default_initialization_3.f90 -O2 execution test
FAIL: gfortran.dg/default_initialization_3.f90 -O3
-fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer
-finline-functions execution test
FAIL: gfortran.dg/default_initialization_3.f90 -O3 -g execution test
FAIL: gfortran.dg/default_initialization_3.f90 -Os execution test
It is failing with STOP 5, so I guess it is over-eagerly removing
initialization in something that is not an interface.
BTW, I think it would be better to open a new issue for this and the
"third issue" you describe for this than to tag them with PR54753, since
these initialization bugs aren't really related to the missing
diagnostic in that issue except so far as the bogus error/crashes make
it impossible to test for the missing diagnostic. Personally, I find it
really confusing to track which bugs have really been fixed when
multiple bugs that need different fixes are lumped together in the same
issue... there might be patches committed for such a mashed-up issue,
but which parts have been fixed and which not, and when is it safe to
close the issue? :-S
-Sandra
next prev parent reply other threads:[~2021-10-02 18:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-29 8:53 Tobias Burnus
2021-09-29 20:10 ` Harald Anlauf
2021-10-01 18:50 ` Harald Anlauf
2021-10-02 18:01 ` Sandra Loosemore [this message]
2021-10-02 18:29 ` Tobias Burnus
2021-10-02 19:19 ` Harald Anlauf
2021-10-02 19:56 ` Tobias Burnus
2021-10-02 20:28 ` Harald Anlauf
2021-10-02 22:40 ` Sandra Loosemore
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=0131e2d5-be68-d3b1-b90f-6640c358e1ab@codesourcery.com \
--to=sandra@codesourcery.com \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=tobias@codesourcery.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).