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 r13-4605] Fortran: fix ICE on bad use of statement function [PR107995] Date: Sun, 11 Dec 2022 19:35:13 +0000 (GMT) [thread overview] Message-ID: <20221211193513.8EB3B3887CD0@sourceware.org> (raw) https://gcc.gnu.org/g:8f72249ff4cbd0a5c701b99ee8aa1ca9d82df046 commit r13-4605-g8f72249ff4cbd0a5c701b99ee8aa1ca9d82df046 Author: Steve Kargl <kargl@gcc.gnu.org> Date: Sat Dec 10 22:17:15 2022 +0100 Fortran: fix ICE on bad use of statement function [PR107995] gcc/fortran/ChangeLog: PR fortran/107995 * interface.cc (gfc_check_dummy_characteristics): Reject statement function dummy arguments. gcc/testsuite/ChangeLog: PR fortran/107995 * gfortran.dg/pr107995.f90: New test. Diff: --- gcc/fortran/interface.cc | 6 ++++++ gcc/testsuite/gfortran.dg/pr107995.f90 | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc index 73799c175b7..7d8eeda5a99 100644 --- a/gcc/fortran/interface.cc +++ b/gcc/fortran/interface.cc @@ -1334,6 +1334,12 @@ gfc_check_dummy_characteristics (gfc_symbol *s1, gfc_symbol *s2, if (s1 == NULL || s2 == NULL) return s1 == s2 ? true : false; + if (s1->attr.proc == PROC_ST_FUNCTION || s2->attr.proc == PROC_ST_FUNCTION) + { + strncpy (errmsg, "Statement function", err_len); + return false; + } + /* Check type and rank. */ if (type_must_agree) { diff --git a/gcc/testsuite/gfortran.dg/pr107995.f90 b/gcc/testsuite/gfortran.dg/pr107995.f90 new file mode 100644 index 00000000000..22e878630b8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr107995.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +! PR fortran/107995 +! Contributed by G.Steinmetz + +program p + implicit none + integer :: n ! { dg-error "Self-referential argument" } + n(n) = 1 ! { dg-warning "Statement function" } + print *, n(n) ! { dg-error "Statement function" } +end
reply other threads:[~2022-12-11 19:35 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=20221211193513.8EB3B3887CD0@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).