return SUCCESS;
gfc_error ("'%s' argument of '%s' intrinsic at %L must be a scalar",
- gfc_current_intrinsic_arg[n], gfc_current_intrinsic, &e->where);
+ gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic,
+ &e->where);
return FAILURE;
}
return SUCCESS;
gfc_error ("'%s' argument of '%s' intrinsic at %L must be %s",
- gfc_current_intrinsic_arg[n], gfc_current_intrinsic, &e->where,
- gfc_basic_typename (type));
+ gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic,
+ &e->where, gfc_basic_typename (type));
return FAILURE;
}
}
gfc_error ("'%s' argument of '%s' intrinsic at %L must be a numeric type",
- gfc_current_intrinsic_arg[n], gfc_current_intrinsic, &e->where);
+ gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic,
+ &e->where);
return FAILURE;
}
if (e->ts.type != BT_INTEGER && e->ts.type != BT_REAL)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be INTEGER "
- "or REAL", gfc_current_intrinsic_arg[n],
+ "or REAL", gfc_current_intrinsic_arg[n]->name,
gfc_current_intrinsic, &e->where);
return FAILURE;
}
if (e->ts.type != BT_REAL && e->ts.type != BT_COMPLEX)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be REAL "
- "or COMPLEX", gfc_current_intrinsic_arg[n],
+ "or COMPLEX", gfc_current_intrinsic_arg[n]->name,
+ gfc_current_intrinsic, &e->where);
+ return FAILURE;
+ }
+
+ return SUCCESS;
+}
+
+
+/* Check that an expression is INTEGER or PROCEDURE. */
+
+static gfc_try
+int_or_proc_check (gfc_expr *e, int n)
+{
+ if (e->ts.type != BT_INTEGER && e->ts.type != BT_PROCEDURE)
+ {
+ gfc_error ("'%s' argument of '%s' intrinsic at %L must be INTEGER "
+ "or PROCEDURE", gfc_current_intrinsic_arg[n]->name,
gfc_current_intrinsic, &e->where);
return FAILURE;
}
if (k->expr_type != EXPR_CONSTANT)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be a constant",
- gfc_current_intrinsic_arg[n], gfc_current_intrinsic,
+ gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic,
&k->where);
return FAILURE;
}
if (d->ts.kind != gfc_default_double_kind)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be double "
- "precision", gfc_current_intrinsic_arg[n],
+ "precision", gfc_current_intrinsic_arg[n]->name,
gfc_current_intrinsic, &d->where);
return FAILURE;
}
}
+static gfc_try
+coarray_check (gfc_expr *e, int n)
+{
+ if (!is_coarray (e))
+ {
+ gfc_error ("Expected coarray variable as '%s' argument to the %s "
+ "intrinsic at %L", gfc_current_intrinsic_arg[n]->name,
+ gfc_current_intrinsic, &e->where);
+ return FAILURE;
+ }
+
+ return SUCCESS;
+}
+
+
/* Make sure the expression is a logical array. */
static gfc_try
if (array->ts.type != BT_LOGICAL || array->rank == 0)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be a logical "
- "array", gfc_current_intrinsic_arg[n], gfc_current_intrinsic,
- &array->where);
+ "array", gfc_current_intrinsic_arg[n]->name,
+ gfc_current_intrinsic, &array->where);
return FAILURE;
}
return SUCCESS;
gfc_error ("'%s' argument of '%s' intrinsic at %L must be an array",
- gfc_current_intrinsic_arg[n], gfc_current_intrinsic, &e->where);
+ gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic,
+ &e->where);
return FAILURE;
}
return SUCCESS;
gfc_error ("'%s' argument of '%s' intrinsic at %L must be the same type "
- "and kind as '%s'", gfc_current_intrinsic_arg[m],
- gfc_current_intrinsic, &f->where, gfc_current_intrinsic_arg[n]);
+ "and kind as '%s'", gfc_current_intrinsic_arg[m]->name,
+ gfc_current_intrinsic, &f->where,
+ gfc_current_intrinsic_arg[n]->name);
return FAILURE;
}
return SUCCESS;
gfc_error ("'%s' argument of '%s' intrinsic at %L must be of rank %d",
- gfc_current_intrinsic_arg[n], gfc_current_intrinsic,
+ gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic,
&e->where, rank);
return FAILURE;
if (e->expr_type == EXPR_VARIABLE && e->symtree->n.sym->attr.optional)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must not be OPTIONAL",
- gfc_current_intrinsic_arg[n], gfc_current_intrinsic,
+ gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic,
&e->where);
}
}
+/* Check for ALLOCATABLE attribute. */
+
+static gfc_try
+allocatable_check (gfc_expr *e, int n)
+{
+ symbol_attribute attr;
+
+ attr = gfc_variable_attr (e, NULL);
+ if (!attr.allocatable)
+ {
+ gfc_error ("'%s' argument of '%s' intrinsic at %L must be ALLOCATABLE",
+ gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic,
+ &e->where);
+ return FAILURE;
+ }
+
+ return SUCCESS;
+}
+
+
/* Check that an expression has a particular kind. */
static gfc_try
return SUCCESS;
gfc_error ("'%s' argument of '%s' intrinsic at %L must be of kind %d",
- gfc_current_intrinsic_arg[n], gfc_current_intrinsic,
+ gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic,
&e->where, k);
return FAILURE;
static gfc_try
variable_check (gfc_expr *e, int n)
{
- if ((e->expr_type == EXPR_VARIABLE
- && e->symtree->n.sym->attr.flavor != FL_PARAMETER)
- || (e->expr_type == EXPR_FUNCTION
- && e->symtree->n.sym->result == e->symtree->n.sym))
- return SUCCESS;
-
if (e->expr_type == EXPR_VARIABLE
- && e->symtree->n.sym->attr.intent == INTENT_IN)
+ && e->symtree->n.sym->attr.intent == INTENT_IN
+ && (gfc_current_intrinsic_arg[n]->intent == INTENT_OUT
+ || gfc_current_intrinsic_arg[n]->intent == INTENT_INOUT))
{
gfc_error ("'%s' argument of '%s' intrinsic at %L cannot be INTENT(IN)",
- gfc_current_intrinsic_arg[n], gfc_current_intrinsic,
+ gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic,
&e->where);
return FAILURE;
}
+ if ((e->expr_type == EXPR_VARIABLE
+ && e->symtree->n.sym->attr.flavor != FL_PARAMETER)
+ || (e->expr_type == EXPR_FUNCTION
+ && e->symtree->n.sym->result == e->symtree->n.sym))
+ return SUCCESS;
+
gfc_error ("'%s' argument of '%s' intrinsic at %L must be a variable",
- gfc_current_intrinsic_arg[n], gfc_current_intrinsic, &e->where);
+ gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic, &e->where);
return FAILURE;
}
gfc_try
gfc_check_allocated (gfc_expr *array)
{
- symbol_attribute attr;
-
if (variable_check (array, 0) == FAILURE)
return FAILURE;
-
- attr = gfc_variable_attr (array, NULL);
- if (!attr.allocatable)
- {
- gfc_error ("'%s' argument of '%s' intrinsic at %L must be ALLOCATABLE",
- gfc_current_intrinsic_arg[0], gfc_current_intrinsic,
- &array->where);
- return FAILURE;
- }
-
+ if (allocatable_check (array, 0) == FAILURE)
+ return FAILURE;
+
return SUCCESS;
}
if (a->ts.type != p->ts.type)
{
gfc_error ("'%s' and '%s' arguments of '%s' intrinsic at %L must "
- "have the same type", gfc_current_intrinsic_arg[0],
- gfc_current_intrinsic_arg[1], gfc_current_intrinsic,
+ "have the same type", gfc_current_intrinsic_arg[0]->name,
+ gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic,
&p->where);
return FAILURE;
}
if (!attr1.pointer && !attr1.proc_pointer)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be a POINTER",
- gfc_current_intrinsic_arg[0], gfc_current_intrinsic,
+ gfc_current_intrinsic_arg[0]->name, gfc_current_intrinsic,
&pointer->where);
return FAILURE;
}
else
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be a pointer "
- "or target VARIABLE or FUNCTION", gfc_current_intrinsic_arg[1],
- gfc_current_intrinsic, &target->where);
+ "or target VARIABLE or FUNCTION",
+ gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic,
+ &target->where);
return FAILURE;
}
if (attr1.pointer && !attr2.pointer && !attr2.target)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be a POINTER "
- "or a TARGET", gfc_current_intrinsic_arg[1],
+ "or a TARGET", gfc_current_intrinsic_arg[1]->name,
gfc_current_intrinsic, &target->where);
return FAILURE;
}
if (x->ts.type == BT_COMPLEX)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must not be "
- "present if 'x' is COMPLEX", gfc_current_intrinsic_arg[1],
- gfc_current_intrinsic, &y->where);
+ "present if 'x' is COMPLEX",
+ gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic,
+ &y->where);
return FAILURE;
}
if (y->ts.type == BT_COMPLEX)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must have a type "
- "of either REAL or INTEGER", gfc_current_intrinsic_arg[1],
- gfc_current_intrinsic, &y->where);
+ "of either REAL or INTEGER",
+ gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic,
+ &y->where);
return FAILURE;
}
gfc_try
gfc_check_complex (gfc_expr *x, gfc_expr *y)
{
- if (x->ts.type != BT_INTEGER && x->ts.type != BT_REAL)
- {
- gfc_error ("'%s' argument of '%s' intrinsic at %L must be INTEGER "
- "or REAL", gfc_current_intrinsic_arg[0],
- gfc_current_intrinsic, &x->where);
- return FAILURE;
- }
+ if (int_or_real_check (x, 0) == FAILURE)
+ return FAILURE;
if (scalar_check (x, 0) == FAILURE)
return FAILURE;
- if (y->ts.type != BT_INTEGER && y->ts.type != BT_REAL)
- {
- gfc_error ("'%s' argument of '%s' intrinsic at %L must be INTEGER "
- "or REAL", gfc_current_intrinsic_arg[1],
- gfc_current_intrinsic, &y->where);
- return FAILURE;
- }
+ if (int_or_real_check (y, 1) == FAILURE)
+ return FAILURE;
if (scalar_check (y, 1) == FAILURE)
return FAILURE;
{
gfc_error ("'%s' argument of '%s' intrinsic at %L has "
"invalid shape in dimension %d (%ld/%ld)",
- gfc_current_intrinsic_arg[1],
+ gfc_current_intrinsic_arg[1]->name,
gfc_current_intrinsic, &shift->where, i + 1,
mpz_get_si (array->shape[i]),
mpz_get_si (shift->shape[j]));
else
{
gfc_error ("'%s' argument of intrinsic '%s' at %L of must have rank "
- "%d or be a scalar", gfc_current_intrinsic_arg[1],
+ "%d or be a scalar", gfc_current_intrinsic_arg[1]->name,
gfc_current_intrinsic, &shift->where, array->rank - 1);
return FAILURE;
}
if (x->ts.type == BT_COMPLEX)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must not be "
- "present if 'x' is COMPLEX", gfc_current_intrinsic_arg[1],
- gfc_current_intrinsic, &y->where);
+ "present if 'x' is COMPLEX",
+ gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic,
+ &y->where);
return FAILURE;
}
if (y->ts.type == BT_COMPLEX)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must have a type "
- "of either REAL or INTEGER", gfc_current_intrinsic_arg[1],
- gfc_current_intrinsic, &y->where);
+ "of either REAL or INTEGER",
+ gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic,
+ &y->where);
return FAILURE;
}
}
default:
gfc_error ("'%s' argument of '%s' intrinsic at %L must be numeric "
- "or LOGICAL", gfc_current_intrinsic_arg[0],
+ "or LOGICAL", gfc_current_intrinsic_arg[0]->name,
gfc_current_intrinsic, &vector_a->where);
return FAILURE;
}
if (! identical_dimen_shape (vector_a, 0, vector_b, 0))
{
gfc_error ("Different shape for arguments '%s' and '%s' at %L for "
- "intrinsic 'dot_product'", gfc_current_intrinsic_arg[0],
- gfc_current_intrinsic_arg[1], &vector_a->where);
+ "intrinsic 'dot_product'", gfc_current_intrinsic_arg[0]->name,
+ gfc_current_intrinsic_arg[1]->name, &vector_a->where);
return FAILURE;
}
if (x->ts.kind != gfc_default_real_kind)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be default "
- "real", gfc_current_intrinsic_arg[0],
+ "real", gfc_current_intrinsic_arg[0]->name,
gfc_current_intrinsic, &x->where);
return FAILURE;
}
if (y->ts.kind != gfc_default_real_kind)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be default "
- "real", gfc_current_intrinsic_arg[1],
+ "real", gfc_current_intrinsic_arg[1]->name,
gfc_current_intrinsic, &y->where);
return FAILURE;
}
{
gfc_error ("'%s' argument of '%s' intrinsic at %L has "
"invalid shape in dimension %d (%ld/%ld)",
- gfc_current_intrinsic_arg[1],
+ gfc_current_intrinsic_arg[1]->name,
gfc_current_intrinsic, &shift->where, i + 1,
mpz_get_si (array->shape[i]),
mpz_get_si (shift->shape[j]));
else
{
gfc_error ("'%s' argument of intrinsic '%s' at %L of must have rank "
- "%d or be a scalar", gfc_current_intrinsic_arg[1],
+ "%d or be a scalar", gfc_current_intrinsic_arg[1]->name,
gfc_current_intrinsic, &shift->where, array->rank - 1);
return FAILURE;
}
if (gfc_check_conformance (shift, boundary,
"arguments '%s' and '%s' for "
"intrinsic %s",
- gfc_current_intrinsic_arg[1],
- gfc_current_intrinsic_arg[2],
+ gfc_current_intrinsic_arg[1]->name,
+ gfc_current_intrinsic_arg[2]->name,
gfc_current_intrinsic ) == FAILURE)
return FAILURE;
}
else
{
gfc_error ("'%s' argument of intrinsic '%s' at %L of must have "
- "rank %d or be a scalar", gfc_current_intrinsic_arg[1],
- gfc_current_intrinsic, &shift->where, array->rank - 1);
+ "rank %d or be a scalar",
+ gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic,
+ &shift->where, array->rank - 1);
return FAILURE;
}
}
if (a->ts.type == BT_COMPLEX
&& gfc_notify_std (GFC_STD_F2008, "Fortran 2008: COMPLEX argument '%s' "
"argument of '%s' intrinsic at %L",
- gfc_current_intrinsic_arg[0], gfc_current_intrinsic,
- &a->where) == FAILURE)
+ gfc_current_intrinsic_arg[0]->name,
+ gfc_current_intrinsic, &a->where) == FAILURE)
return FAILURE;
return SUCCESS;
if (string->ts.kind != substring->ts.kind)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be the same "
- "kind as '%s'", gfc_current_intrinsic_arg[1],
+ "kind as '%s'", gfc_current_intrinsic_arg[1]->name,
gfc_current_intrinsic, &substring->where,
- gfc_current_intrinsic_arg[0]);
+ gfc_current_intrinsic_arg[0]->name);
return FAILURE;
}
if (x->ts.type == BT_DERIVED)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be a "
- "non-derived type", gfc_current_intrinsic_arg[0],
+ "non-derived type", gfc_current_intrinsic_arg[0]->name,
gfc_current_intrinsic, &x->where);
return FAILURE;
}
return FAILURE;
}
- if (!is_coarray (coarray))
- {
- gfc_error ("Expected coarray variable as '%s' argument to the LCOBOUND "
- "intrinsic at %L", gfc_current_intrinsic_arg[0], &coarray->where);
- return FAILURE;
- }
+ if (coarray_check (coarray, 0) == FAILURE)
+ return FAILURE;
if (dim != NULL)
{
if ((matrix_a->ts.type != BT_LOGICAL) && !gfc_numeric_ts (&matrix_a->ts))
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be numeric "
- "or LOGICAL", gfc_current_intrinsic_arg[0],
+ "or LOGICAL", gfc_current_intrinsic_arg[0]->name,
gfc_current_intrinsic, &matrix_a->where);
return FAILURE;
}
if ((matrix_b->ts.type != BT_LOGICAL) && !gfc_numeric_ts (&matrix_b->ts))
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be numeric "
- "or LOGICAL", gfc_current_intrinsic_arg[1],
+ "or LOGICAL", gfc_current_intrinsic_arg[1]->name,
gfc_current_intrinsic, &matrix_b->where);
return FAILURE;
}
{
gfc_error ("Different shape on dimension 1 for arguments '%s' "
"and '%s' at %L for intrinsic matmul",
- gfc_current_intrinsic_arg[0],
- gfc_current_intrinsic_arg[1], &matrix_a->where);
+ gfc_current_intrinsic_arg[0]->name,
+ gfc_current_intrinsic_arg[1]->name, &matrix_a->where);
return FAILURE;
}
break;
{
gfc_error ("Different shape on dimension 2 for argument '%s' and "
"dimension 1 for argument '%s' at %L for intrinsic "
- "matmul", gfc_current_intrinsic_arg[0],
- gfc_current_intrinsic_arg[1], &matrix_a->where);
+ "matmul", gfc_current_intrinsic_arg[0]->name,
+ gfc_current_intrinsic_arg[1]->name, &matrix_a->where);
return FAILURE;
}
break;
default:
gfc_error ("'%s' argument of '%s' intrinsic at %L must be of rank "
- "1 or 2", gfc_current_intrinsic_arg[0],
+ "1 or 2", gfc_current_intrinsic_arg[0]->name,
gfc_current_intrinsic, &matrix_a->where);
return FAILURE;
}
if (m != NULL
&& gfc_check_conformance (a, m,
"arguments '%s' and '%s' for intrinsic %s",
- gfc_current_intrinsic_arg[0],
- gfc_current_intrinsic_arg[2],
+ gfc_current_intrinsic_arg[0]->name,
+ gfc_current_intrinsic_arg[2]->name,
gfc_current_intrinsic ) == FAILURE)
return FAILURE;
if (m != NULL
&& gfc_check_conformance (a, m,
"arguments '%s' and '%s' for intrinsic %s",
- gfc_current_intrinsic_arg[0],
- gfc_current_intrinsic_arg[2],
+ gfc_current_intrinsic_arg[0]->name,
+ gfc_current_intrinsic_arg[2]->name,
gfc_current_intrinsic) == FAILURE)
return FAILURE;
gfc_try
gfc_check_move_alloc (gfc_expr *from, gfc_expr *to)
{
- symbol_attribute attr;
-
if (variable_check (from, 0) == FAILURE)
return FAILURE;
-
- attr = gfc_variable_attr (from, NULL);
- if (!attr.allocatable)
- {
- gfc_error ("'%s' argument of '%s' intrinsic at %L must be ALLOCATABLE",
- gfc_current_intrinsic_arg[0], gfc_current_intrinsic,
- &from->where);
- return FAILURE;
- }
-
- if (variable_check (to, 0) == FAILURE)
+ if (allocatable_check (from, 0) == FAILURE)
return FAILURE;
- attr = gfc_variable_attr (to, NULL);
- if (!attr.allocatable)
- {
- gfc_error ("'%s' argument of '%s' intrinsic at %L must be ALLOCATABLE",
- gfc_current_intrinsic_arg[0], gfc_current_intrinsic,
- &to->where);
- return FAILURE;
- }
+ if (variable_check (to, 1) == FAILURE)
+ return FAILURE;
+ if (allocatable_check (to, 1) == FAILURE)
+ return FAILURE;
if (same_type_check (to, 1, from, 0) == FAILURE)
return FAILURE;
if (to->rank != from->rank)
{
gfc_error ("the '%s' and '%s' arguments of '%s' intrinsic at %L must "
- "have the same rank %d/%d", gfc_current_intrinsic_arg[0],
- gfc_current_intrinsic_arg[1], gfc_current_intrinsic,
+ "have the same rank %d/%d", gfc_current_intrinsic_arg[0]->name,
+ gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic,
&to->where, from->rank, to->rank);
return FAILURE;
}
if (to->ts.kind != from->ts.kind)
{
gfc_error ("the '%s' and '%s' arguments of '%s' intrinsic at %L must "
- "be of the same kind %d/%d", gfc_current_intrinsic_arg[0],
- gfc_current_intrinsic_arg[1], gfc_current_intrinsic,
+ "be of the same kind %d/%d",
+ gfc_current_intrinsic_arg[0]->name,
+ gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic,
&to->where, from->ts.kind, to->ts.kind);
return FAILURE;
}
if (!attr.pointer && !attr.proc_pointer)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be a POINTER",
- gfc_current_intrinsic_arg[0],
+ gfc_current_intrinsic_arg[0]->name,
gfc_current_intrinsic, &mold->where);
return FAILURE;
}
if (gfc_check_conformance (array, mask,
"arguments '%s' and '%s' for intrinsic '%s'",
- gfc_current_intrinsic_arg[0],
- gfc_current_intrinsic_arg[1],
+ gfc_current_intrinsic_arg[0]->name,
+ gfc_current_intrinsic_arg[1]->name,
gfc_current_intrinsic) == FAILURE)
return FAILURE;
gfc_error ("'%s' argument of '%s' intrinsic at %L must "
"provide at least as many elements as there "
"are .TRUE. values in '%s' (%ld/%d)",
- gfc_current_intrinsic_arg[2],gfc_current_intrinsic,
- &vector->where, gfc_current_intrinsic_arg[1],
+ gfc_current_intrinsic_arg[2]->name,
+ gfc_current_intrinsic, &vector->where,
+ gfc_current_intrinsic_arg[1]->name,
mpz_get_si (vector_size), mask_true_values);
return FAILURE;
}
gfc_try
gfc_check_precision (gfc_expr *x)
{
- if (x->ts.type != BT_REAL && x->ts.type != BT_COMPLEX)
- {
- gfc_error ("'%s' argument of '%s' intrinsic at %L must be of type "
- "REAL or COMPLEX", gfc_current_intrinsic_arg[0],
- gfc_current_intrinsic, &x->where);
- return FAILURE;
- }
+ if (real_or_complex_check (x, 0) == FAILURE)
+ return FAILURE;
return SUCCESS;
}
if (!sym->attr.dummy)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be of a "
- "dummy variable", gfc_current_intrinsic_arg[0],
+ "dummy variable", gfc_current_intrinsic_arg[0]->name,
gfc_current_intrinsic, &a->where);
return FAILURE;
}
if (!sym->attr.optional)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be of "
- "an OPTIONAL dummy variable", gfc_current_intrinsic_arg[0],
- gfc_current_intrinsic, &a->where);
+ "an OPTIONAL dummy variable",
+ gfc_current_intrinsic_arg[0]->name, gfc_current_intrinsic,
+ &a->where);
return FAILURE;
}
&& a->ref->u.ar.type == AR_FULL))
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must not be a "
- "subobject of '%s'", gfc_current_intrinsic_arg[0],
+ "subobject of '%s'", gfc_current_intrinsic_arg[0]->name,
gfc_current_intrinsic, &a->where, sym->name);
return FAILURE;
}
if (shape_size <= 0)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L is empty",
- gfc_current_intrinsic_arg[1], gfc_current_intrinsic,
+ gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic,
&shape->where);
return FAILURE;
}
if (extent < 0)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L has "
- "negative element (%d)", gfc_current_intrinsic_arg[1],
+ "negative element (%d)",
+ gfc_current_intrinsic_arg[1]->name,
gfc_current_intrinsic, &e->where, extent);
return FAILURE;
}
{
gfc_error ("'%s' argument of '%s' intrinsic at %L "
"has wrong number of elements (%d/%d)",
- gfc_current_intrinsic_arg[3],
+ gfc_current_intrinsic_arg[3]->name,
gfc_current_intrinsic, &order->where,
order_size, shape_size);
return FAILURE;
{
gfc_error ("'%s' argument of '%s' intrinsic at %L "
"has out-of-range dimension (%d)",
- gfc_current_intrinsic_arg[3],
+ gfc_current_intrinsic_arg[3]->name,
gfc_current_intrinsic, &e->where, dim);
return FAILURE;
}
{
gfc_error ("'%s' argument of '%s' intrinsic at %L has "
"invalid permutation of dimensions (dimension "
- "'%d' duplicated)", gfc_current_intrinsic_arg[3],
+ "'%d' duplicated)",
+ gfc_current_intrinsic_arg[3]->name,
gfc_current_intrinsic, &e->where, dim);
return FAILURE;
}
if (a->ts.type != BT_DERIVED && a->ts.type != BT_CLASS)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L "
- "must be of a derived type", gfc_current_intrinsic_arg[0],
- gfc_current_intrinsic, &a->where);
+ "must be of a derived type",
+ gfc_current_intrinsic_arg[0]->name, gfc_current_intrinsic,
+ &a->where);
return FAILURE;
}
if (!gfc_type_is_extensible (a->ts.u.derived))
{
gfc_error ("'%s' argument of '%s' intrinsic at %L "
- "must be of an extensible type", gfc_current_intrinsic_arg[0],
- gfc_current_intrinsic, &a->where);
+ "must be of an extensible type",
+ gfc_current_intrinsic_arg[0]->name, gfc_current_intrinsic,
+ &a->where);
return FAILURE;
}
if (b->ts.type != BT_DERIVED && b->ts.type != BT_CLASS)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L "
- "must be of a derived type", gfc_current_intrinsic_arg[1],
- gfc_current_intrinsic, &b->where);
+ "must be of a derived type",
+ gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic,
+ &b->where);
return FAILURE;
}
if (!gfc_type_is_extensible (b->ts.u.derived))
{
gfc_error ("'%s' argument of '%s' intrinsic at %L "
- "must be of an extensible type", gfc_current_intrinsic_arg[1],
- gfc_current_intrinsic, &b->where);
+ "must be of an extensible type",
+ gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic,
+ &b->where);
return FAILURE;
}
if (verify_c_interop (&arg->ts) != SUCCESS)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be be an "
- "interoperable data entity", gfc_current_intrinsic_arg[0],
- gfc_current_intrinsic, &arg->where);
+ "interoperable data entity",
+ gfc_current_intrinsic_arg[0]->name, gfc_current_intrinsic,
+ &arg->where);
return FAILURE;
}
return SUCCESS;
if (source->rank >= GFC_MAX_DIMENSIONS)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be less "
- "than rank %d", gfc_current_intrinsic_arg[0],
+ "than rank %d", gfc_current_intrinsic_arg[0]->name,
gfc_current_intrinsic, &source->where, GFC_MAX_DIMENSIONS);
return FAILURE;
|| mpz_cmp_ui (dim->value.integer, source->rank + 1) > 0))
{
gfc_error ("'%s' argument of '%s' intrinsic at %L is not a valid "
- "dimension index", gfc_current_intrinsic_arg[1],
+ "dimension index", gfc_current_intrinsic_arg[1]->name,
gfc_current_intrinsic, &dim->where);
return FAILURE;
}
return FAILURE;
}
- if (!is_coarray (coarray))
- {
- gfc_error ("Expected coarray variable as '%s' argument to IMAGE_INDEX "
- "intrinsic at %L", gfc_current_intrinsic_arg[0], &coarray->where);
- return FAILURE;
- }
+ if (coarray_check (coarray, 0) == FAILURE)
+ return FAILURE;
if (sub->rank != 1)
{
gfc_error ("%s argument to IMAGE_INDEX must be a rank one array at %L",
- gfc_current_intrinsic_arg[1], &sub->where);
+ gfc_current_intrinsic_arg[1]->name, &sub->where);
return FAILURE;
}
if (coarray == NULL)
return SUCCESS;
- if (!is_coarray (coarray))
- {
- gfc_error ("Expected coarray variable as '%s' argument to THIS_IMAGE "
- "intrinsic at %L", gfc_current_intrinsic_arg[0], &coarray->where);
- return FAILURE;
- }
+ if (coarray_check (coarray, 0) == FAILURE)
+ return FAILURE;
if (dim != NULL)
{
return FAILURE;
}
- if (!is_coarray (coarray))
- {
- gfc_error ("Expected coarray variable as '%s' argument to the UCOBOUND "
- "intrinsic at %L", gfc_current_intrinsic_arg[0], &coarray->where);
- return FAILURE;
- }
+ if (coarray_check (coarray, 0) == FAILURE)
+ return FAILURE;
if (dim != NULL)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must "
"provide at least as many elements as there "
"are .TRUE. values in '%s' (%ld/%d)",
- gfc_current_intrinsic_arg[0], gfc_current_intrinsic,
- &vector->where, gfc_current_intrinsic_arg[1],
+ gfc_current_intrinsic_arg[0]->name, gfc_current_intrinsic,
+ &vector->where, gfc_current_intrinsic_arg[1]->name,
mpz_get_si (vector_size), mask_true_count);
return FAILURE;
}
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must have "
"the same rank as '%s' or be a scalar",
- gfc_current_intrinsic_arg[2], gfc_current_intrinsic,
- &field->where, gfc_current_intrinsic_arg[1]);
+ gfc_current_intrinsic_arg[2]->name, gfc_current_intrinsic,
+ &field->where, gfc_current_intrinsic_arg[1]->name);
return FAILURE;
}
{
gfc_error ("'%s' and '%s' arguments of '%s' intrinsic at %L "
"must have identical shape.",
- gfc_current_intrinsic_arg[2],
- gfc_current_intrinsic_arg[1], gfc_current_intrinsic,
+ gfc_current_intrinsic_arg[2]->name,
+ gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic,
&field->where);
}
}
&& mpz_get_ui (put_size) < kiss_size)
gfc_error ("Size of '%s' argument of '%s' intrinsic at %L "
"too small (%i/%i)",
- gfc_current_intrinsic_arg[1], gfc_current_intrinsic, where,
- (int) mpz_get_ui (put_size), kiss_size);
+ gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic,
+ where, (int) mpz_get_ui (put_size), kiss_size);
}
if (get != NULL)
&& mpz_get_ui (get_size) < kiss_size)
gfc_error ("Size of '%s' argument of '%s' intrinsic at %L "
"too small (%i/%i)",
- gfc_current_intrinsic_arg[2], gfc_current_intrinsic, where,
- (int) mpz_get_ui (get_size), kiss_size);
+ gfc_current_intrinsic_arg[2]->name, gfc_current_intrinsic,
+ where, (int) mpz_get_ui (get_size), kiss_size);
}
/* RANDOM_SEED may not have more than one non-optional argument. */
{
if (scalar_check (seconds, 0) == FAILURE)
return FAILURE;
-
if (type_check (seconds, 0, BT_INTEGER) == FAILURE)
return FAILURE;
- if (handler->ts.type != BT_INTEGER && handler->ts.type != BT_PROCEDURE)
- {
- gfc_error ("'%s' argument of '%s' intrinsic at %L must be INTEGER "
- "or PROCEDURE", gfc_current_intrinsic_arg[1],
- gfc_current_intrinsic, &handler->where);
- return FAILURE;
- }
-
+ if (int_or_proc_check (handler, 1) == FAILURE)
+ return FAILURE;
if (handler->ts.type == BT_INTEGER && scalar_check (handler, 1) == FAILURE)
return FAILURE;
if (scalar_check (status, 2) == FAILURE)
return FAILURE;
-
if (type_check (status, 2, BT_INTEGER) == FAILURE)
return FAILURE;
-
if (kind_value_check (status, 2, gfc_default_integer_kind) == FAILURE)
return FAILURE;
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be of a kind "
"not wider than the default kind (%d)",
- gfc_current_intrinsic_arg[0], gfc_current_intrinsic,
+ gfc_current_intrinsic_arg[0]->name, gfc_current_intrinsic,
&pos->where, gfc_default_integer_kind);
return FAILURE;
}
{
if (scalar_check (number, 0) == FAILURE)
return FAILURE;
-
if (type_check (number, 0, BT_INTEGER) == FAILURE)
return FAILURE;
- if (handler->ts.type != BT_INTEGER && handler->ts.type != BT_PROCEDURE)
- {
- gfc_error ("'%s' argument of '%s' intrinsic at %L must be INTEGER "
- "or PROCEDURE", gfc_current_intrinsic_arg[1],
- gfc_current_intrinsic, &handler->where);
- return FAILURE;
- }
-
+ if (int_or_proc_check (handler, 1) == FAILURE)
+ return FAILURE;
if (handler->ts.type == BT_INTEGER && scalar_check (handler, 1) == FAILURE)
return FAILURE;
{
if (scalar_check (number, 0) == FAILURE)
return FAILURE;
-
if (type_check (number, 0, BT_INTEGER) == FAILURE)
return FAILURE;
- if (handler->ts.type != BT_INTEGER && handler->ts.type != BT_PROCEDURE)
- {
- gfc_error ("'%s' argument of '%s' intrinsic at %L must be INTEGER "
- "or PROCEDURE", gfc_current_intrinsic_arg[1],
- gfc_current_intrinsic, &handler->where);
- return FAILURE;
- }
-
+ if (int_or_proc_check (handler, 1) == FAILURE)
+ return FAILURE;
if (handler->ts.type == BT_INTEGER && scalar_check (handler, 1) == FAILURE)
return FAILURE;
if (type_check (status, 2, BT_INTEGER) == FAILURE)
return FAILURE;
-
if (scalar_check (status, 2) == FAILURE)
return FAILURE;
if (i->ts.type != BT_INTEGER && i->ts.type != BT_LOGICAL)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be INTEGER "
- "or LOGICAL", gfc_current_intrinsic_arg[0],
+ "or LOGICAL", gfc_current_intrinsic_arg[0]->name,
gfc_current_intrinsic, &i->where);
return FAILURE;
}
if (j->ts.type != BT_INTEGER && j->ts.type != BT_LOGICAL)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be INTEGER "
- "or LOGICAL", gfc_current_intrinsic_arg[1],
+ "or LOGICAL", gfc_current_intrinsic_arg[1]->name,
gfc_current_intrinsic, &j->where);
return FAILURE;
}
if (i->ts.type != j->ts.type)
{
gfc_error ("'%s' and '%s' arguments of '%s' intrinsic at %L must "
- "have the same type", gfc_current_intrinsic_arg[0],
- gfc_current_intrinsic_arg[1], gfc_current_intrinsic,
+ "have the same type", gfc_current_intrinsic_arg[0]->name,
+ gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic,
&j->where);
return FAILURE;
}
if (kind->expr_type != EXPR_CONSTANT)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must be a constant",
- gfc_current_intrinsic_arg[1], gfc_current_intrinsic,
+ gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic,
&kind->where);
return FAILURE;
}