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