From: Tobias Burnus <tobias@codesourcery.com>
To: Harald Anlauf <anlauf@gmx.de>, fortran <fortran@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fortran: reject MODULE PROCEDURE outside generic module interface [PR99036]
Date: Tue, 21 Mar 2023 09:31:02 +0100 [thread overview]
Message-ID: <7f9d0dc1-21d8-5b55-dc66-a12a5f8c114a@codesourcery.com> (raw)
In-Reply-To: <trinity-fe491b4b-66a9-4d21-b8b1-9af4b907aa10-1679345864578@3c-app-gmx-bap50>
On 20.03.23 21:57, Harald Anlauf via Gcc-patches wrote:
> --- a/gcc/fortran/decl.cc
> +++ b/gcc/fortran/decl.cc
> @@ -9998,6 +9998,7 @@ gfc_match_modproc (void)
> if ((gfc_state_stack->state != COMP_INTERFACE
> && gfc_state_stack->state != COMP_CONTAINS)
> || gfc_state_stack->previous == NULL
> + || !current_interface.type
> || current_interface.type == INTERFACE_NAMELESS
> || current_interface.type == INTERFACE_ABSTRACT)
> {
First, I do not like '!var' comparisons for enum values,
only for Booleans/logicals and pointer.
Secondly, I am not sure that it is really guaranteed that
the value is 0.
I think something like the following makes more sense
and, as just tried, it also regtests (w/ your testcase included).
If you agree, feel free to package and commit it.
diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc
index c8f0bb83c2c..233bf244d62 100644
--- a/gcc/fortran/decl.cc
+++ b/gcc/fortran/decl.cc
@@ -9996,7 +9996,8 @@ gfc_match_modproc (void)
gfc_interface *old_interface_head, *interface;
- if ((gfc_state_stack->state != COMP_INTERFACE
- && gfc_state_stack->state != COMP_CONTAINS)
- || gfc_state_stack->previous == NULL
+ if (gfc_state_stack->previous == NULL
+ || (gfc_state_stack->state != COMP_INTERFACE
+ && (gfc_state_stack->state != COMP_CONTAINS
+ || gfc_state_stack->previous->state != COMP_INTERFACE))
|| current_interface.type == INTERFACE_NAMELESS
|| current_interface.type == INTERFACE_ABSTRACT)
Thanks for working on this and all the other issues!
Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
next prev parent reply other threads:[~2023-03-21 8:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-20 20:57 Harald Anlauf
2023-03-21 7:09 ` Paul Richard Thomas
2023-03-21 8:31 ` Tobias Burnus [this message]
2023-03-21 19:10 ` Harald Anlauf
2023-03-21 19:10 ` Harald Anlauf
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=7f9d0dc1-21d8-5b55-dc66-a12a5f8c114a@codesourcery.com \
--to=tobias@codesourcery.com \
--cc=anlauf@gmx.de \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
/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).