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 r9-9099] PR fortran/95342 - ICE in gfc_match_subroutine, at fortran/decl.c:7913 Date: Fri, 4 Dec 2020 22:31:02 +0000 (GMT) [thread overview] Message-ID: <20201204223102.62E60385EC58@sourceware.org> (raw) https://gcc.gnu.org/g:34e72e050bf4e23689af7061f6381b95339eb7fa commit r9-9099-g34e72e050bf4e23689af7061f6381b95339eb7fa Author: Harald Anlauf <anlauf@gmx.de> Date: Thu Dec 3 20:33:22 2020 +0100 PR fortran/95342 - ICE in gfc_match_subroutine, at fortran/decl.c:7913 Add checks for NULL pointers before dereferencing them. gcc/fortran/ChangeLog: PR fortran/95342 * decl.c (gfc_match_function_decl): Avoid NULL pointer dereference. (gfc_match_subroutine): Likewise. gcc/testsuite/ChangeLog: PR fortran/95342 * gfortran.dg/pr95342.f90: New test. (cherry picked from commit 30b606bb9b9314010a446ea4bed3481632008f75) Diff: --- gcc/fortran/decl.c | 2 ++ gcc/testsuite/gfortran.dg/pr95342.f90 | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index b7987fb24ba..00321da827e 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -7310,6 +7310,7 @@ gfc_match_function_decl (void) procedure interface body. */ if (sym->attr.is_bind_c && sym->attr.module_procedure && sym->old_symbol && strcmp (sym->name, sym->old_symbol->name) == 0 + && sym->binding_label && sym->old_symbol->binding_label && strcmp (sym->binding_label, sym->old_symbol->binding_label) != 0) { const char *null = "NULL", *s1, *s2; @@ -7825,6 +7826,7 @@ gfc_match_subroutine (void) procedure interface body. */ if (sym->attr.module_procedure && sym->old_symbol && strcmp (sym->name, sym->old_symbol->name) == 0 + && sym->binding_label && sym->old_symbol->binding_label && strcmp (sym->binding_label, sym->old_symbol->binding_label) != 0) { const char *null = "NULL", *s1, *s2; diff --git a/gcc/testsuite/gfortran.dg/pr95342.f90 b/gcc/testsuite/gfortran.dg/pr95342.f90 new file mode 100644 index 00000000000..41c987d3bbb --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr95342.f90 @@ -0,0 +1,20 @@ +! { dg-do compile } +! PR fortran/95342 - ICE in gfc_match_subroutine, at fortran/decl.c:7913 + +module m1 + interface + module subroutine s() + end + subroutine s() bind(c) ! { dg-error "EXTERNAL attribute conflicts" } + end ! { dg-error "END INTERFACE" } + end interface +end + +module m2 + interface + module function f() + end + function f() bind(c) + end ! { dg-error "Duplicate EXTERNAL attribute" } + end interface +end
reply other threads:[~2020-12-04 22:31 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=20201204223102.62E60385EC58@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).