+2004-08-22 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
+
+ * check.c (gfc_check_reduction): Rename to ...
+ (check_reduction): ... this. Make static. Don't check type of
+ first argument.
+ (gfc_check_minval_maxval, gfc_check_prodcut_sum): New functions.
+ * intrinsic.c (add_functions): Change MAXVAL, MINVAL, PRODUCT and
+ SUM to use new check functions.
+ (check_specific): Change logic to call new functions.
+ * intrinsic.h (gfc_check_minval_maxval, gfc_check_product_sum):
+ Add prototypes.
+ (gfc_check_reduction): Remove prototype.
+
2004-08-20 Paul Brook <paul@codesourcery.com>
Canqun Yang <canqun@nudt.edu.cn>
I.e. in the case of minval(array,mask), mask will be in the second
position of the argument list and we'll have to fix that up. */
-try
-gfc_check_reduction (gfc_actual_arglist * ap)
+static try
+check_reduction (gfc_actual_arglist * ap)
{
- gfc_expr *a, *m, *d;
-
- a = ap->expr;
- if (int_or_real_check (a, 0) == FAILURE
- || array_check (a, 0) == FAILURE)
- return FAILURE;
+ gfc_expr *m, *d;
d = ap->next->expr;
m = ap->next->next->expr;
}
+try
+gfc_check_minval_maxval (gfc_actual_arglist * ap)
+{
+
+ if (int_or_real_check (ap->expr, 0) == FAILURE
+ || array_check (ap->expr, 0) == FAILURE)
+ return FAILURE;
+
+ return check_reduction (ap);
+}
+
+
+try
+gfc_check_product_sum (gfc_actual_arglist * ap)
+{
+
+ if (numeric_check (ap->expr, 0) == FAILURE
+ || array_check (ap->expr, 0) == FAILURE)
+ return FAILURE;
+
+ return check_reduction (ap);
+}
+
+
try
gfc_check_merge (gfc_expr * tsource, gfc_expr * fsource, gfc_expr * mask)
{
make_generic ("maxloc", GFC_ISYM_MAXLOC);
add_sym_3red ("maxval", 0, 1, BT_REAL, dr,
- gfc_check_reduction, NULL, gfc_resolve_maxval,
+ gfc_check_minval_maxval, NULL, gfc_resolve_maxval,
ar, BT_REAL, dr, 0, dm, BT_INTEGER, ii, 1,
msk, BT_LOGICAL, dl, 1);
make_generic ("minloc", GFC_ISYM_MINLOC);
add_sym_3red ("minval", 0, 1, BT_REAL, dr,
- gfc_check_reduction, NULL, gfc_resolve_minval,
+ gfc_check_minval_maxval, NULL, gfc_resolve_minval,
ar, BT_REAL, dr, 0, dm, BT_INTEGER, ii, 1,
msk, BT_LOGICAL, dl, 1);
make_generic ("present", GFC_ISYM_PRESENT);
add_sym_3red ("product", 0, 1, BT_REAL, dr,
- gfc_check_reduction, NULL, gfc_resolve_product,
+ gfc_check_product_sum, NULL, gfc_resolve_product,
ar, BT_REAL, dr, 0, dm, BT_INTEGER, ii, 1,
msk, BT_LOGICAL, dl, 1);
make_generic ("sqrt", GFC_ISYM_SQRT);
add_sym_3red ("sum", 0, 1, BT_UNKNOWN, 0,
- gfc_check_reduction, NULL, gfc_resolve_sum,
+ gfc_check_product_sum, NULL, gfc_resolve_sum,
ar, BT_REAL, dr, 0, dm, BT_INTEGER, ii, 1,
msk, BT_LOGICAL, dl, 1);
/* This is special because we might have to reorder the argument
list. */
t = gfc_check_minloc_maxloc (*ap);
- else if (specific->check.f3red == gfc_check_reduction)
+ else if (specific->check.f3red == gfc_check_minval_maxval)
/* This is also special because we also might have to reorder the
argument list. */
- t = gfc_check_reduction (*ap);
+ t = gfc_check_minval_maxval (*ap);
+ else if (specific->check.f3red == gfc_check_product_sum)
+ /* Same here. The difference to the previous case is that we allow a
+ general numeric type. */
+ t = gfc_check_product_sum (*ap);
else
{
if (specific->check.f1 == NULL)
try gfc_check_matmul (gfc_expr *, gfc_expr *);
try gfc_check_merge (gfc_expr *, gfc_expr *, gfc_expr *);
try gfc_check_minloc_maxloc (gfc_actual_arglist *);
+try gfc_check_minval_maxval (gfc_actual_arglist *);
try gfc_check_nearest (gfc_expr *, gfc_expr *);
try gfc_check_null (gfc_expr *);
try gfc_check_pack (gfc_expr *, gfc_expr *, gfc_expr *);
try gfc_check_precision (gfc_expr *);
try gfc_check_present (gfc_expr *);
+try gfc_check_product_sum (gfc_actual_arglist *);
try gfc_check_radix (gfc_expr *);
try gfc_check_rand (gfc_expr *);
try gfc_check_range (gfc_expr *);
try gfc_check_real (gfc_expr *, gfc_expr *);
-try gfc_check_reduction (gfc_actual_arglist *);
try gfc_check_repeat (gfc_expr *, gfc_expr *);
try gfc_check_reshape (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
try gfc_check_scale (gfc_expr *, gfc_expr *);