Hello Hans-Peter,

Many thanks for that. The folk at Linaro posted a testsuite failure for the
submitted patch. I corrected three of the casts but, as you found, somehow
the fourth escaped me. Linaro notified me that the pushed version was
failing and it was my intention to attend to that today. You have saved me
the trouble and so I can get on with something more suited to a Sunday :-)

By the way, the standard just specifies integer for 'dim' in reduce, which
I take to mean it should be default_integer_kind. I didn't see any obvious
way of finding that in the library. Could somebody on the list advise,
please?

Best regards

Paul



On Sat, 22 Mar 2025 at 18:00, Hans-Peter Nilsson <h...@axis.com> wrote:

> Not many newlib targets (AFAIK the only targets where
> GFC_INTEGER_4 alias int32_t is a typedef of long int)
> build libgfortran.
>
> These breaks happen from time to time.  I wish there was a
> method to stop int32_t (and its typedef-alias GFC_INTEGER_4)
> being type-compatible with int.  The commit message is
> almost the same as that for r15-6427-ga5b1f3e14ae635.
>
> Committed as obvious after a build of libgfortran for
> cris-elf succeeded with this patch.
>
> -- >8 --
> Without this, after r15-8650-g94fa9f4d27bac5, you'll see,
> for targets where GFC_INTEGER_4 alias int32_t is a typedef
> of long int (beware of artificially broken lines):
>
> /x/gcc/libgfortran/intrinsics/reduce.c:269:1: error: conflicting types for
> 'reduce_scalar_c'; have 'void(void *, index_type,  parray *, void (*)(void
> *, void *, void *), int *, gfc_array_l4 *, void *, void *, index_type,
> index_type)' {aka 'void(void *, long int,  parray *, void (*)(void *, void
> *, void *), int *, gfc_array_l4 *, void *, void *, long int,  long int)'}
>   269 | reduce_scalar_c (void *res,
>       | ^~~~~~~~~~~~~~~
> [...] excessive error message verbiage deleted
> /x/gcc/libgfortran/intrinsics/reduce.c: In function 'reduce_scalar_c':
> /x/gcc/libgfortran/intrinsics/reduce.c:283:35: error: passing argument 4
> of 'reduce' from incompatible pointer type [-Wincompatible-pointer-types]
>   283 |   reduce (&ret, array, operation, dim, mask, identity, ordered);
>       |                                   ^~~
>       |                                   |
>       |                                   int *
> /x/gcc/libgfortran/intrinsics/reduce.c:41:24: note: expected
> 'GFC_INTEGER_4 *' {aka 'long int *'} but argument is of type 'int *'
>    41 |         GFC_INTEGER_4 *dim,
>       |         ~~~~~~~~~~~~~~~^~~
> make[3]: *** [Makefile:4678: intrinsics/reduce.lo] Error 1
>
> libgfortran:
>         * intrinsics/reduce.c (reduce_scalar_c): Correct type of parameter
> DIM.
> ---
>  libgfortran/intrinsics/reduce.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libgfortran/intrinsics/reduce.c
> b/libgfortran/intrinsics/reduce.c
> index 63997d874baa..c8950e41fd01 100644
> --- a/libgfortran/intrinsics/reduce.c
> +++ b/libgfortran/intrinsics/reduce.c
> @@ -270,7 +270,7 @@ reduce_scalar_c (void *res,
>                  index_type res_strlen __attribute__ ((unused)),
>                  parray *array,
>                  void (*operation) (void *, void *, void *),
> -                int *dim,
> +                GFC_INTEGER_4 *dim,
>                  gfc_array_l4 *mask,
>                  void *identity,
>                  void *ordered,
> --
> 2.30.2
>
> brgds, H-P
>

Reply via email to