Am 19.09.24 um 11:55 schrieb Andre Vehreschild:
Hi Thomas,
thanks for the patch. I have one proposal/question and one missing verb (IMO).
Else the patch looks fine to me. Ok for trunk.
diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi
index 829ab00c665..e5ffe67eeee 100644
--- a/gcc/fortran/gfortran.texi
+++ b/gcc/fortran/gfortran.texi
@@ -2788,7 +2788,7 @@ As of now, the following intrinsics take unsigned
arguments: @item @code{MVBITS}
@item @code{RANGE}
@item @code{TRANSFER}
-@item @code{MATMUL} and @code{DOT_PRODUCT}
+@item @code{SUM}, @code{PRODUCT}, @code{MATMUL} and @code{DOT_PRODUCT}
How about sorting those alphabetically and putting each on a separate line?
This might make it more viewable. Just a suggestion.
I tried to group them somewhat logically, but you're right, this may be
better. Eventually, I want to document the UNSIGNED arguments to
all intrinsics so they are in the right place.
I think I will re-sort this after all intrinsics have been finished.
@end itemize
This list will grow in the near future.
@c ---------------------------------------------------------------------
diff --git a/gcc/fortran/iresolve.cc b/gcc/fortran/iresolve.cc
index 32b31432e58..92a591cf6d7 100644
--- a/gcc/fortran/iresolve.cc
+++ b/gcc/fortran/iresolve.cc
@@ -175,9 +175,11 @@ resolve_bound (gfc_expr *f, gfc_expr *array, gfc_expr
*dim, gfc_expr *kind,
static void
resolve_transformational (const char *name, gfc_expr *f, gfc_expr *array,
- gfc_expr *dim, gfc_expr *mask)
+ gfc_expr *dim, gfc_expr *mask,
+ bool use_integer = false)
{
const char *prefix;
+ bt type;
f->ts = array->ts;
@@ -200,9 +202,18 @@ resolve_transformational (const char *name, gfc_expr *f,
gfc_expr *array, gfc_resolve_dim_arg (dim);
}
+ /* For those intrinsic like SUM where we the integer version
There is a verb missing here, IMO. ... where we _use_ the ... ???
This sentence no verb, correct :-)
+ actually uses unsigned, but we call it as the integer
+ version. */
+
+ if (use_integer && array->ts.type == BT_UNSIGNED)
+ type = BT_INTEGER;
+ else
+ type = array->ts.type;
+
f->value.function.name
= gfc_get_string (PREFIX ("%s%s_%c%d"), prefix, name,
- gfc_type_letter (array->ts.type),
+ gfc_type_letter (type),
gfc_type_abi_kind (&array->ts));
}
Regards and thanks for the patch,
Andre
Thanks!
Best regards
Thomas