if (ref->type == REF_COMPONENT)
coarray = ref->u.c.component->attr.codimension;
else if (ref->type != REF_ARRAY || ref->u.ar.dimen != 0
- || ref->u.ar.codimen != 0)
+ || ref->u.ar.codimen != 0)
coarray = false;
}
}
return SUCCESS;
-}
+}
/* Make sure the expression is a logical array. */
static gfc_try
array_check (gfc_expr *e, int n)
{
- if (e->rank != 0)
+ if (e->rank != 0 && e->ts.type != BT_PROCEDURE))
return SUCCESS;
gfc_error ("'%s' argument of '%s' intrinsic at %L must be an array",
if (expr->expr_type != EXPR_CONSTANT)
return SUCCESS;
-
+
i = gfc_validate_kind (BT_INTEGER, k, false);
gfc_extract_int (expr, &val);
|| (ref->u.c.component->ts.type != BT_CLASS
&& ref->u.c.component->attr.pointer)))
break;
- }
+ }
if (!ref)
{
{
if (mpz_cmp (a_size, b_size) != 0)
ret = 0;
-
+
mpz_clear (b_size);
}
mpz_clear (a_size);
return FAILURE;
if (allocatable_check (array, 0) == FAILURE)
return FAILURE;
-
+
return SUCCESS;
}
return SUCCESS;
i = mpz_get_si (c->ts.u.cl->length->value.integer);
}
- else
+ else
return SUCCESS;
}
else
if (i != 1)
{
- gfc_error ("Argument of %s at %L must be of length one",
+ gfc_error ("Argument of %s at %L must be of length one",
gfc_current_intrinsic, &c->where);
return FAILURE;
}
if (order_size != shape_size)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L "
- "has wrong number of elements (%d/%d)",
+ "has wrong number of elements (%d/%d)",
gfc_current_intrinsic_arg[3]->name,
gfc_current_intrinsic, &order->where,
order_size, shape_size);
if (dim < 1 || dim > order_size)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L "
- "has out-of-range dimension (%d)",
+ "has out-of-range dimension (%d)",
gfc_current_intrinsic_arg[3]->name,
gfc_current_intrinsic, &e->where, dim);
return FAILURE;
gfc_constructor *c;
bool test;
-
+
mpz_init_set_ui (size, 1);
for (c = gfc_constructor_first (shape->value.constructor);
c; c = gfc_constructor_next (c))
return FAILURE;
/* dim_rank_check() does not apply here. */
- if (dim
+ if (dim
&& dim->expr_type == EXPR_CONSTANT
&& (mpz_cmp_ui (dim->value.integer, 1) < 0
|| mpz_cmp_ui (dim->value.integer, source->rank + 1) > 0))
if (mask->rank != field->rank && field->rank != 0)
{
gfc_error ("'%s' argument of '%s' intrinsic at %L must have "
- "the same rank as '%s' or be a scalar",
+ "the same rank as '%s' or be a scalar",
gfc_current_intrinsic_arg[2]->name, gfc_current_intrinsic,
&field->where, gfc_current_intrinsic_arg[1]->name);
return FAILURE;
if (! identical_dimen_shape (mask, i, field, i))
{
gfc_error ("'%s' and '%s' arguments of '%s' intrinsic at %L "
- "must have identical shape.",
+ "must have identical shape.",
gfc_current_intrinsic_arg[2]->name,
gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic,
&field->where);
--- /dev/null
+! { dg-do compile }
+! Test the fix for PR55362; the error below was missed and an ICE ensued.
+!
+! ! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
+!
+program ice_test
+ implicit none
+ write(*,*) 'message: ', &
+ size(Error_Msg),Error_Msg() ! { dg-error "must be an array" }
+ write(*,*) 'message: ', &
+ size(Error_Msg ()),Error_Msg() ! OK of course
+contains
+ function Error_Msg() result(ErrorMsg)
+ character, dimension(:), pointer :: ErrorMsg
+ character, dimension(1), target :: str = '!'
+ ErrorMsg => str
+ end function Error_Msg
+end program ice_test