https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103418

--- Comment #9 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Thu, Nov 25, 2021 at 10:10:32PM +0000, anlauf at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103418
> 
> --- Comment #6 from anlauf at gcc dot gnu.org ---
> Unfortunately the patch in comment#5 does not work for me. :-(
> 
> Interestingly, the Intel compiler fails on the testcase, too.
> 

"does not work for me" isn't too descriptive.

I just bootstrap gcc on x86_64-*-freebsd from clean
source (i.e., no  patches at all).  There are failures
with reshape_shape_2.f90 and vector_subscript_1.f90.

If I apply my simply patch, 

% git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   gcc/fortran/check.c

no changes added to commit (use "git add" and/or "git commit -a")

% git diff gcc/fortran/check.c | cat
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 5a5aca10ebe..a0870fc87f1 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,

then the code compiles and produces

% gfcx -o z a.f90
% ./z
 0.76536 0.09307 0.55571 0.28371 0.79951

Reply via email to