]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgfortran/intrinsics: Fix build for targets with int32_t=long int
authorHans-Peter Nilsson <hp@axis.com>
Sat, 22 Mar 2025 17:27:10 +0000 (18:27 +0100)
committerHans-Peter Nilsson <hp@gcc.gnu.org>
Sat, 22 Mar 2025 17:56:37 +0000 (18:56 +0100)
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

index 63997d874baad05f000a41bcccb3fc78b469655c..c8950e41fd0194ef68d06b1cb4875a6a00464fd0 100644 (file)
@@ -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,