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 r12-6596] Fortran: always reject alternate return specifier as argument of intrinsics Date: Fri, 14 Jan 2022 20:48:46 +0000 (GMT) [thread overview] Message-ID: <20220114204847.02CC53858C39@sourceware.org> (raw) https://gcc.gnu.org/g:70e24c9682ddbcade0301665bccd8e7f928d0082 commit r12-6596-g70e24c9682ddbcade0301665bccd8e7f928d0082 Author: Harald Anlauf <anlauf@gmx.de> Date: Fri Jan 14 21:48:15 2022 +0100 Fortran: always reject alternate return specifier as argument of intrinsics The intrinsics MOVE_ALLOC, C_F_POINTER, and C_F_PROCPOINTER require deferred checks of part of their actual argument types which may be of "any" type. This however excludes alternate return specifiers which therefore must be unconditionally rejected for all standard intrinsics. gcc/fortran/ChangeLog: PR fortran/99256 * intrinsic.c: Do not check formal argument type when checking arguments of intrinsics for alternate return specifiers. gcc/testsuite/ChangeLog: PR fortran/99256 * gfortran.dg/altreturn_11.f90: New test. Diff: --- gcc/fortran/intrinsic.c | 2 +- gcc/testsuite/gfortran.dg/altreturn_11.f90 | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index a7ecdb401ef..9746cd5ddb6 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -4420,7 +4420,7 @@ do_sort: FOR_EACH_VEC_ELT (dummy_args, idx, f) { a = ordered_actual_args[idx]; - if (a && a->label != NULL && f->ts.type) + if (a && a->label != NULL) { gfc_error ("ALTERNATE RETURN not permitted at %L", where); return false; diff --git a/gcc/testsuite/gfortran.dg/altreturn_11.f90 b/gcc/testsuite/gfortran.dg/altreturn_11.f90 new file mode 100644 index 00000000000..be42971d781 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/altreturn_11.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! { dg-prune-output "Obsolescent feature: Alternate-return argument" } +! PR fortran/99256 - ICE in variable_check +! Contributed by G.Steimetz + +program test + use iso_c_binding + type(c_ptr) :: i + type(c_funptr) :: p + call move_alloc (*1, *2) ! { dg-error "ALTERNATE RETURN" } + call c_f_pointer (i, *1) ! { dg-error "ALTERNATE RETURN" } + call c_f_procpointer (p, *2) ! { dg-error "ALTERNATE RETURN" } +1 continue +2 stop +end
reply other threads:[~2022-01-14 20:48 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=20220114204847.02CC53858C39@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).