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

--- Comment #3 from Jürgen Reuter <juergen.reuter at desy dot de> ---
(In reply to anlauf from comment #2)
> The following patch fixes the reduced testcase for me, as well as the
> full testcase in comment#0:
> 
> diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
> index 26e7adaa03f..3e1a400fa33 100644
> --- a/gcc/fortran/trans-array.cc
> +++ b/gcc/fortran/trans-array.cc
> @@ -3600,7 +3600,9 @@ array_bound_check_elemental (gfc_se * se, gfc_ss * ss,
> gfc_expr * expr)
>             continue;
>           }
>  
> -       if (ref->type == REF_ARRAY && ref->u.ar.dimen > 0)
> +       if (ref->type == REF_ARRAY
> +           && ref->u.ar.type == AR_SECTION
> +           && ref->u.ar.dimen > 0)
>           {
>             ar = &ref->u.ar;
>             for (dim = 0; dim < ar->dimen; dim++)
> 
> Can you give it a spin?

Thanks for the quick reaction, indeed with your fix, all our tests do work
again when all check flags are switched on (we don't do it in our CI with
gfortran, but with only with nagfor, so I just noticed it now).

Reply via email to