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; }