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 r10-10746] Fortran: a RECURSIVE procedure cannot be an INTRINSIC Date: Mon, 16 May 2022 19:39:59 +0000 (GMT) [thread overview] Message-ID: <20220516193959.76D603858D3C@sourceware.org> (raw) https://gcc.gnu.org/g:d31975be113562448520f4c94fc75b9cbb09715e commit r10-10746-gd31975be113562448520f4c94fc75b9cbb09715e Author: Harald Anlauf <anlauf@gmx.de> Date: Mon Apr 4 20:42:51 2022 +0200 Fortran: a RECURSIVE procedure cannot be an INTRINSIC gcc/fortran/ChangeLog: PR fortran/105138 * intrinsic.c (gfc_is_intrinsic): When a symbol refers to a RECURSIVE procedure, it cannot be an INTRINSIC. gcc/testsuite/ChangeLog: PR fortran/105138 * gfortran.dg/recursive_reference_3.f90: New test. Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org> (cherry picked from commit d46685b04071a485b56de353d997a866bfc8caba) Diff: --- gcc/fortran/intrinsic.c | 1 + gcc/testsuite/gfortran.dg/recursive_reference_3.f90 | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index efe79a9bec6..958a319e2aa 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -1138,6 +1138,7 @@ gfc_is_intrinsic (gfc_symbol* sym, int subroutine_flag, locus loc) /* Check for attributes which prevent the symbol from being INTRINSIC. */ if (sym->attr.external || sym->attr.contained + || sym->attr.recursive || sym->attr.if_source == IFSRC_IFBODY) return false; diff --git a/gcc/testsuite/gfortran.dg/recursive_reference_3.f90 b/gcc/testsuite/gfortran.dg/recursive_reference_3.f90 new file mode 100644 index 00000000000..f4e2963aec2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/recursive_reference_3.f90 @@ -0,0 +1,14 @@ +! { dg-do compile } +! { dg-options "-std=f2018" } +! PR fortran/105138 - recursive procedures and shadowing of intrinsics + +RECURSIVE FUNCTION LOG_GAMMA(Z) RESULT(RES) + COMPLEX, INTENT(IN) :: Z + COMPLEX :: RES + RES = LOG_GAMMA(Z) +END FUNCTION LOG_GAMMA + +recursive subroutine date_and_time (z) + real :: z + if (z > 0) call date_and_time (z-1) +end subroutine date_and_time
reply other threads:[~2022-05-16 19:39 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=20220516193959.76D603858D3C@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).