public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-10596] Fortran: reject MODULE PROCEDURE outside generic module interface [PR99036]
@ 2023-03-24 18:41 Harald Anlauf
0 siblings, 0 replies; only message in thread
From: Harald Anlauf @ 2023-03-24 18:41 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:2055702e8d492be6e978fa93a7bfefd358d5d9e3
commit r11-10596-g2055702e8d492be6e978fa93a7bfefd358d5d9e3
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.c (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.c | 7 ++++---
gcc/testsuite/gfortran.dg/pr99036.f90 | 9 +++++++++
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 6eb39d36196..efe3a2285a7 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -9902,9 +9902,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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-03-24 18:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-24 18:41 [gcc r11-10596] Fortran: reject MODULE PROCEDURE outside generic module interface [PR99036] Harald Anlauf
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).