public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "sgk at troutmask dot apl.washington.edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/103418] random_number() does not accept pointer, intent(in) array argument Date: Thu, 25 Nov 2021 21:07:23 +0000 [thread overview] Message-ID: <bug-103418-4-TxK4gHm9Is@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-103418-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103418 --- Comment #5 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Thu, Nov 25, 2021 at 09:02:34PM +0000, anlauf at gcc dot gnu.org wrote: > (In reply to kargl from comment #3) > > (In reply to anlauf from comment #2) > > > The nearly obvious fix: > > > > > > diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c > > > index 837eb0912c0..3859e18c6c3 100644 > > > --- a/gcc/fortran/check.c > > > +++ b/gcc/fortran/check.c > > > @@ -1031,7 +1031,7 @@ variable_check (gfc_expr *e, int n, bool allow_proc) > > > break; > > > } > > > > > > - if (!ref) > > > + if (!ref && !pointer) > > > { > > > gfc_error ("%qs argument of %qs intrinsic at %L cannot be " > > > "INTENT(IN)", gfc_current_intrinsic_arg[n]->name, > > > > > > regresses for gfortran.dg/move_alloc_8.f90, thus needs additional > > > investigation. > > > > Did you try the patch posted in Fortran Discourse? > > No. > > I'm afraid I also missed it on the usual channels where patches for gcc > are posted. > As explained on FD, I don't report problems found be other people who post them in FD, stackoverflow, or c.l.f. I encourage those people to report the problems themselves. That said, you found the right location to patch. The code looks convoluted to deal with CLASS, which messes up an array with the pointer attribute. diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index 6ea6e136d4f..e96bcdb1b44 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -1031,7 +1031,7 @@ variable_check (gfc_expr *e, int n, bool allow_proc) break; } - if (!ref) + if (!ref && !(pointer && e->ref && e->ref->type == REF_ARRAY)) { gfc_error ("%qs argument of %qs intrinsic at %L cannot be " "INTENT(IN)", gfc_current_intrinsic_arg[n]->name, @@ -1062,7 +1062,8 @@ variable_check (gfc_expr *e, int n, bool allow_proc) return true; gfc_error ("%qs argument of %qs intrinsic at %L must be a variable", - gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic, &e->where); + gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic, + &e->where); return false; }
next prev parent reply other threads:[~2021-11-25 21:07 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-11-24 20:59 [Bug fortran/103418] New: " baradi09 at gmail dot com 2021-11-24 21:41 ` [Bug fortran/103418] " anlauf at gcc dot gnu.org 2021-11-24 22:10 ` anlauf at gcc dot gnu.org 2021-11-24 23:27 ` kargl at gcc dot gnu.org 2021-11-25 21:02 ` anlauf at gcc dot gnu.org 2021-11-25 21:07 ` sgk at troutmask dot apl.washington.edu [this message] 2021-11-25 22:10 ` anlauf at gcc dot gnu.org 2021-11-25 22:18 ` sgk at troutmask dot apl.washington.edu 2021-11-25 23:19 ` sgk at troutmask dot apl.washington.edu 2021-11-26 19:27 ` sgk at troutmask dot apl.washington.edu 2021-11-26 20:13 ` anlauf at gcc dot gnu.org 2021-11-26 21:58 ` sgk at troutmask dot apl.washington.edu 2021-12-05 21:55 ` anlauf at gcc dot gnu.org 2021-12-10 18:07 ` cvs-commit at gcc dot gnu.org 2021-12-19 21:20 ` cvs-commit at gcc dot gnu.org 2021-12-27 20:33 ` cvs-commit at gcc dot gnu.org 2021-12-27 20:35 ` anlauf at gcc dot gnu.org
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=bug-103418-4-TxK4gHm9Is@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).