Hi Andre,

On Mon, 7 Apr 2025 at 07:29, Andre Vehreschild <ve...@gmx.de> wrote:

> Hi Paul,
>
> shouldn't this be done in iresolve.cc to make other parts of gfortran
> benefit
> from learning, that the sym is allocatable?
>
> I'll give it a try. I was attempting to eliminate any wider side effects
by setting the temporary symbol to be allocatable. However, I suppose that,
by its nature, the only side effect is on other calls to scalar_reduce.


> --- a/libgfortran/intrinsics/reduce.c
> +++ b/libgfortran/intrinsics/reduce.c
> @@ -83,8 +83,8 @@ reduce (parray *ret,
>    if (dim_present)
>      {
>        if ((*dim < 1) || (*dim > (GFC_INTEGER_4)array_rank))
> -       runtime_error ("DIM in REDUCE intrinsic is less than 0 or greater
> than
> "
> -                      "the rank of ARRAY");
> +       runtime_error ("Mismatch between DIM in and the rank of ARRAY in
> the "
>
> ... DIM and the rank ... ???
>

Yes, 0 < dim <= ARRAY->rank being asserted.


>
> +                      "REDUCE intrinsic (%d/%d)", (int)*dim, array_rank);
>        dimen = (index_type) *dim;
>      }
>    else
>
> ...
>
>        if (masked && (ext != GFC_DESCRIPTOR_EXTENT (mask, i)))
> -       runtime_error ("shape mismatch between ARRAY and MASK in REDUCE "
> -                      "intrinsic");
> +       {
> +         int mext = (int)GFC_DESCRIPTOR_EXTENT (mask, i);
> +         runtime_error ("shape mismatch between ARRAY and MASK in REDUCE "
> +                        "intrinsic (%d/%d)", (int)ext, mext);
>
> size_t mext = ...
> runtime_error ("... intrinsic (%zd/%d)", ext, mext);
>
> %zd is for size_t and other size related variable-output. It might be more
> precise. Just an idea.
>

OK

>
>
> Please check your Changelog for style. When I am not mistaken, then a .
> has to
> be followed by two spaces. Or did this change? I like to use git
> gcc-verify on
> my commit message. That points out some easy to spot oversights.
>

I have yet to test with gcc-verify. Being a Sunday, I had better things to
do than polish a gfortran patch that was going to await the reporters'
thumbs up before pushing :-)


>
> Besides those minor nits: Looks good to me. Ok to merge, when reports have
> verified.
>
> Thanks for the patch,
>         Andre
>

Thanks for the review.

Paul

Reply via email to