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 r8-10520] PR fortran/93423 - ICE on invalid with argument list for module procedure Date: Sat, 19 Sep 2020 18:42:05 +0000 (GMT) [thread overview] Message-ID: <20200919184205.310F3385781A@sourceware.org> (raw) https://gcc.gnu.org/g:aef149efb6d3fc97a38c74f7022124a6ba247746 commit r8-10520-gaef149efb6d3fc97a38c74f7022124a6ba247746 Author: Harald Anlauf <anlauf@gmx.de> Date: Thu Jul 2 20:48:16 2020 +0200 PR fortran/93423 - ICE on invalid with argument list for module procedure When recovering from an error, a NULL pointer dereference could occur. Check for that situation and punt. gcc/fortran/ PR fortran/93423 * resolve.c (resolve_symbol): Avoid NULL pointer dereference. (cherry picked from commit b88744905a46be44ffa3c57d46080f601ae832b8) Diff: --- gcc/fortran/resolve.c | 2 +- gcc/testsuite/gfortran.dg/pr93423.f90 | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 462d07351ad..be63ce50bf2 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -15348,7 +15348,7 @@ resolve_symbol (gfc_symbol *sym) if (formal) { sym->formal_ns = formal->sym->ns; - if (sym->ns != formal->sym->ns) + if (sym->formal_ns && sym->ns != formal->sym->ns) sym->formal_ns->refs++; } } diff --git a/gcc/testsuite/gfortran.dg/pr93423.f90 b/gcc/testsuite/gfortran.dg/pr93423.f90 new file mode 100644 index 00000000000..fed5914daba --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr93423.f90 @@ -0,0 +1,21 @@ +! { dg-do compile } +! PR fortran/93423 - ICE on invalid with argument list for module procedure + +module t + type :: b + contains + procedure :: p => bp + end type b + interface + module function bp(s) + class(b), intent(inout) :: s + integer, pointer :: bp + end function + end interface +end module t + +submodule (t) ts +contains + module procedure bp(s) ! { dg-error "must be in a generic module interface" } + end procedure bp ! { dg-error "Expecting END SUBMODULE statement" } +end submodule ts
reply other threads:[~2020-09-19 18:42 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=20200919184205.310F3385781A@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).