public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Harald Anlauf <anlauf@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-9311] Fortran: reject MODULE PROCEDURE outside generic module interface [PR99036] Date: Wed, 22 Mar 2023 18:00:19 +0000 (GMT) [thread overview] Message-ID: <20230322180019.1E8023850439@sourceware.org> (raw) https://gcc.gnu.org/g:7eb94c5adfd85c38e4ed7a7fff74b59087ddb813 commit r12-9311-g7eb94c5adfd85c38e4ed7a7fff74b59087ddb813 Author: Harald Anlauf <anlauf@gmx.de> Date: Tue Mar 21 19:58:31 2023 +0100 Fortran: reject MODULE PROCEDURE outside generic module interface [PR99036] gcc/fortran/ChangeLog: PR fortran/99036 * decl.cc (gfc_match_modproc): Reject MODULE PROCEDURE if not in a generic module interface. gcc/testsuite/ChangeLog: PR fortran/99036 * gfortran.dg/pr99036.f90: New test. (cherry picked from commit dd282b16bfd3c6e218dffb7798a375365b10ae22) Diff: --- gcc/fortran/decl.cc | 7 ++++--- gcc/testsuite/gfortran.dg/pr99036.f90 | 9 +++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc index b6400514731..b89ed17be50 100644 --- a/gcc/fortran/decl.cc +++ b/gcc/fortran/decl.cc @@ -9984,9 +9984,10 @@ gfc_match_modproc (void) gfc_namespace *module_ns; 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) { diff --git a/gcc/testsuite/gfortran.dg/pr99036.f90 b/gcc/testsuite/gfortran.dg/pr99036.f90 new file mode 100644 index 00000000000..a6e396f6f71 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr99036.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! PR fortran/99036 - ICE in gfc_current_interface_head +! Contributed by G. Steinmetz + +module m +contains + module procedure s ! { dg-error "must be in a generic module interface" } + end +end
reply other threads:[~2023-03-22 18:00 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=20230322180019.1E8023850439@sourceware.org \ --to=anlauf@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).