Commit f3e1097b by Janus Weil

re PR fortran/78798 ([cleanup] some int-valued functions should be bool)

2016-12-15  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78798
	* gfortran.h (gfc_compare_derived_types,gfc_compare_types,
	gfc_compare_interfaces,gfc_has_vector_subscript): Return bool instead
	of int.
	* interface.c (compare_components): Ditto.
	(gfc_compare_union_types): Rename to compare_union_types, declare as
	static, return bool.
	(gfc_compare_derived_types): Return bool instead of int.
	(gfc_compare_types): Ditto.
	(compare_type): Ditto.
	(compare_rank): Ditto.
	(compare_type_rank): Ditto.
	(compare_type_rank_if): Ditto.
	(count_types_test): Ditto.
	(generic_correspondence): Ditto.
	(gfc_compare_interfaces): Ditto.
	(check_interface0): Ditto.
	(check_interface1): Ditto.
	(compare_allocatable): Ditto.
	(compare_parameter): Ditto.
	(gfc_has_vector_subscript): Ditto.
	(compare_actual_formal): Ditto.

From-SVN: r243726
parent 155c9907
2016-12-15 Janus Weil <janus@gcc.gnu.org> 2016-12-15 Janus Weil <janus@gcc.gnu.org>
PR fortran/78798
* gfortran.h (gfc_compare_derived_types,gfc_compare_types,
gfc_compare_interfaces,gfc_has_vector_subscript): Return bool instead
of int.
* interface.c (compare_components): Ditto.
(gfc_compare_union_types): Rename to compare_union_types, declare as
static, return bool.
(gfc_compare_derived_types): Return bool instead of int.
(gfc_compare_types): Ditto.
(compare_type): Ditto.
(compare_rank): Ditto.
(compare_type_rank): Ditto.
(compare_type_rank_if): Ditto.
(count_types_test): Ditto.
(generic_correspondence): Ditto.
(gfc_compare_interfaces): Ditto.
(check_interface0): Ditto.
(check_interface1): Ditto.
(compare_allocatable): Ditto.
(compare_parameter): Ditto.
(gfc_has_vector_subscript): Ditto.
(compare_actual_formal): Ditto.
2016-12-15 Janus Weil <janus@gcc.gnu.org>
PR fortran/78800 PR fortran/78800
* interface.c (compare_allocatable): Avoid additional errors on bad * interface.c (compare_allocatable): Avoid additional errors on bad
class declarations. class declarations.
......
...@@ -3225,13 +3225,13 @@ bool gfc_ref_dimen_size (gfc_array_ref *, int dimen, mpz_t *, mpz_t *); ...@@ -3225,13 +3225,13 @@ bool gfc_ref_dimen_size (gfc_array_ref *, int dimen, mpz_t *, mpz_t *);
/* interface.c -- FIXME: some of these should be in symbol.c */ /* interface.c -- FIXME: some of these should be in symbol.c */
void gfc_free_interface (gfc_interface *); void gfc_free_interface (gfc_interface *);
int gfc_compare_derived_types (gfc_symbol *, gfc_symbol *); bool gfc_compare_derived_types (gfc_symbol *, gfc_symbol *);
int gfc_compare_types (gfc_typespec *, gfc_typespec *); bool gfc_compare_types (gfc_typespec *, gfc_typespec *);
bool gfc_check_dummy_characteristics (gfc_symbol *, gfc_symbol *, bool gfc_check_dummy_characteristics (gfc_symbol *, gfc_symbol *,
bool, char *, int); bool, char *, int);
bool gfc_check_result_characteristics (gfc_symbol *, gfc_symbol *, bool gfc_check_result_characteristics (gfc_symbol *, gfc_symbol *,
char *, int); char *, int);
int gfc_compare_interfaces (gfc_symbol*, gfc_symbol*, const char *, int, int, bool gfc_compare_interfaces (gfc_symbol*, gfc_symbol*, const char *, int, int,
char *, int, const char *, const char *); char *, int, const char *, const char *);
void gfc_check_interfaces (gfc_namespace *); void gfc_check_interfaces (gfc_namespace *);
bool gfc_procedure_use (gfc_symbol *, gfc_actual_arglist **, locus *); bool gfc_procedure_use (gfc_symbol *, gfc_actual_arglist **, locus *);
...@@ -3248,7 +3248,7 @@ void gfc_set_current_interface_head (gfc_interface *); ...@@ -3248,7 +3248,7 @@ void gfc_set_current_interface_head (gfc_interface *);
gfc_symtree* gfc_find_sym_in_symtree (gfc_symbol*); gfc_symtree* gfc_find_sym_in_symtree (gfc_symbol*);
bool gfc_arglist_matches_symbol (gfc_actual_arglist**, gfc_symbol*); bool gfc_arglist_matches_symbol (gfc_actual_arglist**, gfc_symbol*);
bool gfc_check_operator_interface (gfc_symbol*, gfc_intrinsic_op, locus); bool gfc_check_operator_interface (gfc_symbol*, gfc_intrinsic_op, locus);
int gfc_has_vector_subscript (gfc_expr*); bool gfc_has_vector_subscript (gfc_expr*);
gfc_intrinsic_op gfc_equivalent_op (gfc_intrinsic_op); gfc_intrinsic_op gfc_equivalent_op (gfc_intrinsic_op);
bool gfc_check_typebound_override (gfc_symtree*, gfc_symtree*); bool gfc_check_typebound_override (gfc_symtree*, gfc_symtree*);
void gfc_check_dtio_interfaces (gfc_symbol*); void gfc_check_dtio_interfaces (gfc_symbol*);
......
...@@ -471,29 +471,29 @@ is_anonymous_dt (gfc_symbol *derived) ...@@ -471,29 +471,29 @@ is_anonymous_dt (gfc_symbol *derived)
/* Compare components according to 4.4.2 of the Fortran standard. */ /* Compare components according to 4.4.2 of the Fortran standard. */
static int static bool
compare_components (gfc_component *cmp1, gfc_component *cmp2, compare_components (gfc_component *cmp1, gfc_component *cmp2,
gfc_symbol *derived1, gfc_symbol *derived2) gfc_symbol *derived1, gfc_symbol *derived2)
{ {
/* Compare names, but not for anonymous components such as UNION or MAP. */ /* Compare names, but not for anonymous components such as UNION or MAP. */
if (!is_anonymous_component (cmp1) && !is_anonymous_component (cmp2) if (!is_anonymous_component (cmp1) && !is_anonymous_component (cmp2)
&& strcmp (cmp1->name, cmp2->name) != 0) && strcmp (cmp1->name, cmp2->name) != 0)
return 0; return false;
if (cmp1->attr.access != cmp2->attr.access) if (cmp1->attr.access != cmp2->attr.access)
return 0; return false;
if (cmp1->attr.pointer != cmp2->attr.pointer) if (cmp1->attr.pointer != cmp2->attr.pointer)
return 0; return false;
if (cmp1->attr.dimension != cmp2->attr.dimension) if (cmp1->attr.dimension != cmp2->attr.dimension)
return 0; return false;
if (cmp1->attr.allocatable != cmp2->attr.allocatable) if (cmp1->attr.allocatable != cmp2->attr.allocatable)
return 0; return false;
if (cmp1->attr.dimension && gfc_compare_array_spec (cmp1->as, cmp2->as) == 0) if (cmp1->attr.dimension && gfc_compare_array_spec (cmp1->as, cmp2->as) == 0)
return 0; return false;
if (cmp1->ts.type == BT_CHARACTER && cmp2->ts.type == BT_CHARACTER) if (cmp1->ts.type == BT_CHARACTER && cmp2->ts.type == BT_CHARACTER)
{ {
...@@ -503,25 +503,25 @@ compare_components (gfc_component *cmp1, gfc_component *cmp2, ...@@ -503,25 +503,25 @@ compare_components (gfc_component *cmp1, gfc_component *cmp2,
&& l1->length->expr_type == EXPR_CONSTANT && l1->length->expr_type == EXPR_CONSTANT
&& l2->length->expr_type == EXPR_CONSTANT && l2->length->expr_type == EXPR_CONSTANT
&& gfc_dep_compare_expr (l1->length, l2->length) != 0) && gfc_dep_compare_expr (l1->length, l2->length) != 0)
return 0; return false;
} }
/* Make sure that link lists do not put this function into an /* Make sure that link lists do not put this function into an
endless recursive loop! */ endless recursive loop! */
if (!(cmp1->ts.type == BT_DERIVED && derived1 == cmp1->ts.u.derived) if (!(cmp1->ts.type == BT_DERIVED && derived1 == cmp1->ts.u.derived)
&& !(cmp2->ts.type == BT_DERIVED && derived2 == cmp2->ts.u.derived) && !(cmp2->ts.type == BT_DERIVED && derived2 == cmp2->ts.u.derived)
&& gfc_compare_types (&cmp1->ts, &cmp2->ts) == 0) && !gfc_compare_types (&cmp1->ts, &cmp2->ts))
return 0; return false;
else if ( (cmp1->ts.type == BT_DERIVED && derived1 == cmp1->ts.u.derived) else if ( (cmp1->ts.type == BT_DERIVED && derived1 == cmp1->ts.u.derived)
&& !(cmp2->ts.type == BT_DERIVED && derived2 == cmp2->ts.u.derived)) && !(cmp2->ts.type == BT_DERIVED && derived2 == cmp2->ts.u.derived))
return 0; return false;
else if (!(cmp1->ts.type == BT_DERIVED && derived1 == cmp1->ts.u.derived) else if (!(cmp1->ts.type == BT_DERIVED && derived1 == cmp1->ts.u.derived)
&& (cmp2->ts.type == BT_DERIVED && derived2 == cmp2->ts.u.derived)) && (cmp2->ts.type == BT_DERIVED && derived2 == cmp2->ts.u.derived))
return 0; return false;
return 1; return true;
} }
...@@ -533,20 +533,20 @@ compare_components (gfc_component *cmp1, gfc_component *cmp2, ...@@ -533,20 +533,20 @@ compare_components (gfc_component *cmp1, gfc_component *cmp2,
gfc_compare_derived_types, 'equal' is closer to meaning 'duplicate gfc_compare_derived_types, 'equal' is closer to meaning 'duplicate
definitions' than 'equivalent structure'. */ definitions' than 'equivalent structure'. */
int static bool
gfc_compare_union_types (gfc_symbol *un1, gfc_symbol *un2) compare_union_types (gfc_symbol *un1, gfc_symbol *un2)
{ {
gfc_component *map1, *map2, *cmp1, *cmp2; gfc_component *map1, *map2, *cmp1, *cmp2;
gfc_symbol *map1_t, *map2_t; gfc_symbol *map1_t, *map2_t;
if (un1->attr.flavor != FL_UNION || un2->attr.flavor != FL_UNION) if (un1->attr.flavor != FL_UNION || un2->attr.flavor != FL_UNION)
return 0; return false;
if (un1->attr.zero_comp != un2->attr.zero_comp) if (un1->attr.zero_comp != un2->attr.zero_comp)
return 0; return false;
if (un1->attr.zero_comp) if (un1->attr.zero_comp)
return 1; return true;
map1 = un1->components; map1 = un1->components;
map2 = un2->components; map2 = un2->components;
...@@ -567,10 +567,10 @@ gfc_compare_union_types (gfc_symbol *un1, gfc_symbol *un2) ...@@ -567,10 +567,10 @@ gfc_compare_union_types (gfc_symbol *un1, gfc_symbol *un2)
/* Protect against null components. */ /* Protect against null components. */
if (map1_t->attr.zero_comp != map2_t->attr.zero_comp) if (map1_t->attr.zero_comp != map2_t->attr.zero_comp)
return 0; return false;
if (map1_t->attr.zero_comp) if (map1_t->attr.zero_comp)
return 1; return true;
for (;;) for (;;)
{ {
...@@ -578,8 +578,8 @@ gfc_compare_union_types (gfc_symbol *un1, gfc_symbol *un2) ...@@ -578,8 +578,8 @@ gfc_compare_union_types (gfc_symbol *un1, gfc_symbol *un2)
the same component, because one map field is created with its type the same component, because one map field is created with its type
declaration. Therefore don't worry about recursion here. */ declaration. Therefore don't worry about recursion here. */
/* TODO: worry about recursion into parent types of the unions? */ /* TODO: worry about recursion into parent types of the unions? */
if (compare_components (cmp1, cmp2, map1_t, map2_t) == 0) if (!compare_components (cmp1, cmp2, map1_t, map2_t))
return 0; return false;
cmp1 = cmp1->next; cmp1 = cmp1->next;
cmp2 = cmp2->next; cmp2 = cmp2->next;
...@@ -587,7 +587,7 @@ gfc_compare_union_types (gfc_symbol *un1, gfc_symbol *un2) ...@@ -587,7 +587,7 @@ gfc_compare_union_types (gfc_symbol *un1, gfc_symbol *un2)
if (cmp1 == NULL && cmp2 == NULL) if (cmp1 == NULL && cmp2 == NULL)
break; break;
if (cmp1 == NULL || cmp2 == NULL) if (cmp1 == NULL || cmp2 == NULL)
return 0; return false;
} }
map1 = map1->next; map1 = map1->next;
...@@ -596,10 +596,10 @@ gfc_compare_union_types (gfc_symbol *un1, gfc_symbol *un2) ...@@ -596,10 +596,10 @@ gfc_compare_union_types (gfc_symbol *un1, gfc_symbol *un2)
if (map1 == NULL && map2 == NULL) if (map1 == NULL && map2 == NULL)
break; break;
if (map1 == NULL || map2 == NULL) if (map1 == NULL || map2 == NULL)
return 0; return false;
} }
return 1; return true;
} }
...@@ -607,20 +607,20 @@ gfc_compare_union_types (gfc_symbol *un1, gfc_symbol *un2) ...@@ -607,20 +607,20 @@ gfc_compare_union_types (gfc_symbol *un1, gfc_symbol *un2)
/* Compare two derived types using the criteria in 4.4.2 of the standard, /* Compare two derived types using the criteria in 4.4.2 of the standard,
recursing through gfc_compare_types for the components. */ recursing through gfc_compare_types for the components. */
int bool
gfc_compare_derived_types (gfc_symbol *derived1, gfc_symbol *derived2) gfc_compare_derived_types (gfc_symbol *derived1, gfc_symbol *derived2)
{ {
gfc_component *cmp1, *cmp2; gfc_component *cmp1, *cmp2;
if (derived1 == derived2) if (derived1 == derived2)
return 1; return true;
if (!derived1 || !derived2) if (!derived1 || !derived2)
gfc_internal_error ("gfc_compare_derived_types: invalid derived type"); gfc_internal_error ("gfc_compare_derived_types: invalid derived type");
/* Compare UNION types specially. */ /* Compare UNION types specially. */
if (derived1->attr.flavor == FL_UNION || derived2->attr.flavor == FL_UNION) if (derived1->attr.flavor == FL_UNION || derived2->attr.flavor == FL_UNION)
return gfc_compare_union_types (derived1, derived2); return compare_union_types (derived1, derived2);
/* Special case for comparing derived types across namespaces. If the /* Special case for comparing derived types across namespaces. If the
true names and module names are the same and the module name is true names and module names are the same and the module name is
...@@ -628,7 +628,7 @@ gfc_compare_derived_types (gfc_symbol *derived1, gfc_symbol *derived2) ...@@ -628,7 +628,7 @@ gfc_compare_derived_types (gfc_symbol *derived1, gfc_symbol *derived2)
if (strcmp (derived1->name, derived2->name) == 0 if (strcmp (derived1->name, derived2->name) == 0
&& derived1->module != NULL && derived2->module != NULL && derived1->module != NULL && derived2->module != NULL
&& strcmp (derived1->module, derived2->module) == 0) && strcmp (derived1->module, derived2->module) == 0)
return 1; return true;
/* Compare type via the rules of the standard. Both types must have /* Compare type via the rules of the standard. Both types must have
the SEQUENCE or BIND(C) attribute to be equal. STRUCTUREs are special the SEQUENCE or BIND(C) attribute to be equal. STRUCTUREs are special
...@@ -638,22 +638,22 @@ gfc_compare_derived_types (gfc_symbol *derived1, gfc_symbol *derived2) ...@@ -638,22 +638,22 @@ gfc_compare_derived_types (gfc_symbol *derived1, gfc_symbol *derived2)
/* Compare names, but not for anonymous types such as UNION or MAP. */ /* Compare names, but not for anonymous types such as UNION or MAP. */
if (!is_anonymous_dt (derived1) && !is_anonymous_dt (derived2) if (!is_anonymous_dt (derived1) && !is_anonymous_dt (derived2)
&& strcmp (derived1->name, derived2->name) != 0) && strcmp (derived1->name, derived2->name) != 0)
return 0; return false;
if (derived1->component_access == ACCESS_PRIVATE if (derived1->component_access == ACCESS_PRIVATE
|| derived2->component_access == ACCESS_PRIVATE) || derived2->component_access == ACCESS_PRIVATE)
return 0; return false;
if (!(derived1->attr.sequence && derived2->attr.sequence) if (!(derived1->attr.sequence && derived2->attr.sequence)
&& !(derived1->attr.is_bind_c && derived2->attr.is_bind_c)) && !(derived1->attr.is_bind_c && derived2->attr.is_bind_c))
return 0; return false;
/* Protect against null components. */ /* Protect against null components. */
if (derived1->attr.zero_comp != derived2->attr.zero_comp) if (derived1->attr.zero_comp != derived2->attr.zero_comp)
return 0; return false;
if (derived1->attr.zero_comp) if (derived1->attr.zero_comp)
return 1; return true;
cmp1 = derived1->components; cmp1 = derived1->components;
cmp2 = derived2->components; cmp2 = derived2->components;
...@@ -664,7 +664,7 @@ gfc_compare_derived_types (gfc_symbol *derived1, gfc_symbol *derived2) ...@@ -664,7 +664,7 @@ gfc_compare_derived_types (gfc_symbol *derived1, gfc_symbol *derived2)
for (;;) for (;;)
{ {
if (!compare_components (cmp1, cmp2, derived1, derived2)) if (!compare_components (cmp1, cmp2, derived1, derived2))
return 0; return false;
cmp1 = cmp1->next; cmp1 = cmp1->next;
cmp2 = cmp2->next; cmp2 = cmp2->next;
...@@ -672,16 +672,16 @@ gfc_compare_derived_types (gfc_symbol *derived1, gfc_symbol *derived2) ...@@ -672,16 +672,16 @@ gfc_compare_derived_types (gfc_symbol *derived1, gfc_symbol *derived2)
if (cmp1 == NULL && cmp2 == NULL) if (cmp1 == NULL && cmp2 == NULL)
break; break;
if (cmp1 == NULL || cmp2 == NULL) if (cmp1 == NULL || cmp2 == NULL)
return 0; return false;
} }
return 1; return true;
} }
/* Compare two typespecs, recursively if necessary. */ /* Compare two typespecs, recursively if necessary. */
int bool
gfc_compare_types (gfc_typespec *ts1, gfc_typespec *ts2) gfc_compare_types (gfc_typespec *ts1, gfc_typespec *ts2)
{ {
/* See if one of the typespecs is a BT_VOID, which is what is being used /* See if one of the typespecs is a BT_VOID, which is what is being used
...@@ -689,7 +689,7 @@ gfc_compare_types (gfc_typespec *ts1, gfc_typespec *ts2) ...@@ -689,7 +689,7 @@ gfc_compare_types (gfc_typespec *ts1, gfc_typespec *ts2)
TODO: Possibly should narrow this to just the one typespec coming in TODO: Possibly should narrow this to just the one typespec coming in
that is for the formal arg, but oh well. */ that is for the formal arg, but oh well. */
if (ts1->type == BT_VOID || ts2->type == BT_VOID) if (ts1->type == BT_VOID || ts2->type == BT_VOID)
return 1; return true;
/* The _data component is not always present, therefore check for its /* The _data component is not always present, therefore check for its
presence before assuming, that its derived->attr is available. presence before assuming, that its derived->attr is available.
...@@ -700,7 +700,7 @@ gfc_compare_types (gfc_typespec *ts1, gfc_typespec *ts2) ...@@ -700,7 +700,7 @@ gfc_compare_types (gfc_typespec *ts1, gfc_typespec *ts2)
&& ts1->u.derived->components->ts.u.derived->attr && ts1->u.derived->components->ts.u.derived->attr
.unlimited_polymorphic) .unlimited_polymorphic)
|| ts1->u.derived->attr.unlimited_polymorphic)) || ts1->u.derived->attr.unlimited_polymorphic))
return 1; return true;
/* F2003: C717 */ /* F2003: C717 */
if (ts2->type == BT_CLASS && ts1->type == BT_DERIVED if (ts2->type == BT_CLASS && ts1->type == BT_DERIVED
...@@ -710,15 +710,15 @@ gfc_compare_types (gfc_typespec *ts1, gfc_typespec *ts2) ...@@ -710,15 +710,15 @@ gfc_compare_types (gfc_typespec *ts1, gfc_typespec *ts2)
.unlimited_polymorphic) .unlimited_polymorphic)
|| ts2->u.derived->attr.unlimited_polymorphic) || ts2->u.derived->attr.unlimited_polymorphic)
&& (ts1->u.derived->attr.sequence || ts1->u.derived->attr.is_bind_c)) && (ts1->u.derived->attr.sequence || ts1->u.derived->attr.is_bind_c))
return 1; return true;
if (ts1->type != ts2->type if (ts1->type != ts2->type
&& ((ts1->type != BT_DERIVED && ts1->type != BT_CLASS) && ((ts1->type != BT_DERIVED && ts1->type != BT_CLASS)
|| (ts2->type != BT_DERIVED && ts2->type != BT_CLASS))) || (ts2->type != BT_DERIVED && ts2->type != BT_CLASS)))
return 0; return false;
if (ts1->type == BT_UNION) if (ts1->type == BT_UNION)
return gfc_compare_union_types (ts1->u.derived, ts2->u.derived); return compare_union_types (ts1->u.derived, ts2->u.derived);
if (ts1->type != BT_DERIVED && ts1->type != BT_CLASS) if (ts1->type != BT_DERIVED && ts1->type != BT_CLASS)
return (ts1->kind == ts2->kind); return (ts1->kind == ts2->kind);
...@@ -728,30 +728,30 @@ gfc_compare_types (gfc_typespec *ts1, gfc_typespec *ts2) ...@@ -728,30 +728,30 @@ gfc_compare_types (gfc_typespec *ts1, gfc_typespec *ts2)
} }
static int static bool
compare_type (gfc_symbol *s1, gfc_symbol *s2) compare_type (gfc_symbol *s1, gfc_symbol *s2)
{ {
if (s2->attr.ext_attr & (1 << EXT_ATTR_NO_ARG_CHECK)) if (s2->attr.ext_attr & (1 << EXT_ATTR_NO_ARG_CHECK))
return 1; return true;
/* TYPE and CLASS of the same declared type are type compatible, /* TYPE and CLASS of the same declared type are type compatible,
but have different characteristics. */ but have different characteristics. */
if ((s1->ts.type == BT_CLASS && s2->ts.type == BT_DERIVED) if ((s1->ts.type == BT_CLASS && s2->ts.type == BT_DERIVED)
|| (s1->ts.type == BT_DERIVED && s2->ts.type == BT_CLASS)) || (s1->ts.type == BT_DERIVED && s2->ts.type == BT_CLASS))
return 0; return false;
return gfc_compare_types (&s1->ts, &s2->ts) || s2->ts.type == BT_ASSUMED; return gfc_compare_types (&s1->ts, &s2->ts) || s2->ts.type == BT_ASSUMED;
} }
static int static bool
compare_rank (gfc_symbol *s1, gfc_symbol *s2) compare_rank (gfc_symbol *s1, gfc_symbol *s2)
{ {
gfc_array_spec *as1, *as2; gfc_array_spec *as1, *as2;
int r1, r2; int r1, r2;
if (s2->attr.ext_attr & (1 << EXT_ATTR_NO_ARG_CHECK)) if (s2->attr.ext_attr & (1 << EXT_ATTR_NO_ARG_CHECK))
return 1; return true;
as1 = (s1->ts.type == BT_CLASS) ? CLASS_DATA (s1)->as : s1->as; as1 = (s1->ts.type == BT_CLASS) ? CLASS_DATA (s1)->as : s1->as;
as2 = (s2->ts.type == BT_CLASS) ? CLASS_DATA (s2)->as : s2->as; as2 = (s2->ts.type == BT_CLASS) ? CLASS_DATA (s2)->as : s2->as;
...@@ -760,17 +760,17 @@ compare_rank (gfc_symbol *s1, gfc_symbol *s2) ...@@ -760,17 +760,17 @@ compare_rank (gfc_symbol *s1, gfc_symbol *s2)
r2 = as2 ? as2->rank : 0; r2 = as2 ? as2->rank : 0;
if (r1 != r2 && (!as2 || as2->type != AS_ASSUMED_RANK)) if (r1 != r2 && (!as2 || as2->type != AS_ASSUMED_RANK))
return 0; /* Ranks differ. */ return false; /* Ranks differ. */
return 1; return true;
} }
/* Given two symbols that are formal arguments, compare their ranks /* Given two symbols that are formal arguments, compare their ranks
and types. Returns nonzero if they have the same rank and type, and types. Returns true if they have the same rank and type,
zero otherwise. */ false otherwise. */
static int static bool
compare_type_rank (gfc_symbol *s1, gfc_symbol *s2) compare_type_rank (gfc_symbol *s1, gfc_symbol *s2)
{ {
return compare_type (s1, s2) && compare_rank (s1, s2); return compare_type (s1, s2) && compare_rank (s1, s2);
...@@ -779,44 +779,44 @@ compare_type_rank (gfc_symbol *s1, gfc_symbol *s2) ...@@ -779,44 +779,44 @@ compare_type_rank (gfc_symbol *s1, gfc_symbol *s2)
/* Given two symbols that are formal arguments, compare their types /* Given two symbols that are formal arguments, compare their types
and rank and their formal interfaces if they are both dummy and rank and their formal interfaces if they are both dummy
procedures. Returns nonzero if the same, zero if different. */ procedures. Returns true if the same, false if different. */
static int static bool
compare_type_rank_if (gfc_symbol *s1, gfc_symbol *s2) compare_type_rank_if (gfc_symbol *s1, gfc_symbol *s2)
{ {
if (s1 == NULL || s2 == NULL) if (s1 == NULL || s2 == NULL)
return s1 == s2 ? 1 : 0; return (s1 == s2);
if (s1 == s2) if (s1 == s2)
return 1; return true;
if (s1->attr.flavor != FL_PROCEDURE && s2->attr.flavor != FL_PROCEDURE) if (s1->attr.flavor != FL_PROCEDURE && s2->attr.flavor != FL_PROCEDURE)
return compare_type_rank (s1, s2); return compare_type_rank (s1, s2);
if (s1->attr.flavor != FL_PROCEDURE || s2->attr.flavor != FL_PROCEDURE) if (s1->attr.flavor != FL_PROCEDURE || s2->attr.flavor != FL_PROCEDURE)
return 0; return false;
/* At this point, both symbols are procedures. It can happen that /* At this point, both symbols are procedures. It can happen that
external procedures are compared, where one is identified by usage external procedures are compared, where one is identified by usage
to be a function or subroutine but the other is not. Check TKR to be a function or subroutine but the other is not. Check TKR
nonetheless for these cases. */ nonetheless for these cases. */
if (s1->attr.function == 0 && s1->attr.subroutine == 0) if (s1->attr.function == 0 && s1->attr.subroutine == 0)
return s1->attr.external == 1 ? compare_type_rank (s1, s2) : 0; return s1->attr.external ? compare_type_rank (s1, s2) : false;
if (s2->attr.function == 0 && s2->attr.subroutine == 0) if (s2->attr.function == 0 && s2->attr.subroutine == 0)
return s2->attr.external == 1 ? compare_type_rank (s1, s2) : 0; return s2->attr.external ? compare_type_rank (s1, s2) : false;
/* Now the type of procedure has been identified. */ /* Now the type of procedure has been identified. */
if (s1->attr.function != s2->attr.function if (s1->attr.function != s2->attr.function
|| s1->attr.subroutine != s2->attr.subroutine) || s1->attr.subroutine != s2->attr.subroutine)
return 0; return false;
if (s1->attr.function && compare_type_rank (s1, s2) == 0) if (s1->attr.function && !compare_type_rank (s1, s2))
return 0; return false;
/* Originally, gfortran recursed here to check the interfaces of passed /* Originally, gfortran recursed here to check the interfaces of passed
procedures. This is explicitly not required by the standard. */ procedures. This is explicitly not required by the standard. */
return 1; return true;
} }
...@@ -1089,11 +1089,11 @@ bad_repl: ...@@ -1089,11 +1089,11 @@ bad_repl:
by this test. This subroutine implements rule 1 of section F03:16.2.3. by this test. This subroutine implements rule 1 of section F03:16.2.3.
'p1' and 'p2' are the PASS arguments of both procedures (if applicable). */ 'p1' and 'p2' are the PASS arguments of both procedures (if applicable). */
static int static bool
count_types_test (gfc_formal_arglist *f1, gfc_formal_arglist *f2, count_types_test (gfc_formal_arglist *f1, gfc_formal_arglist *f2,
const char *p1, const char *p2) const char *p1, const char *p2)
{ {
int rc, ac1, ac2, i, j, k, n1; int ac1, ac2, i, j, k, n1;
gfc_formal_arglist *f; gfc_formal_arglist *f;
typedef struct typedef struct
...@@ -1148,7 +1148,7 @@ count_types_test (gfc_formal_arglist *f1, gfc_formal_arglist *f2, ...@@ -1148,7 +1148,7 @@ count_types_test (gfc_formal_arglist *f1, gfc_formal_arglist *f2,
/* Now loop over each distinct type found in f1. */ /* Now loop over each distinct type found in f1. */
k = 0; k = 0;
rc = 0; bool rc = false;
for (i = 0; i < n1; i++) for (i = 0; i < n1; i++)
{ {
...@@ -1172,7 +1172,7 @@ count_types_test (gfc_formal_arglist *f1, gfc_formal_arglist *f2, ...@@ -1172,7 +1172,7 @@ count_types_test (gfc_formal_arglist *f1, gfc_formal_arglist *f2,
if (ac1 > ac2) if (ac1 > ac2)
{ {
rc = 1; rc = true;
break; break;
} }
...@@ -1206,7 +1206,7 @@ count_types_test (gfc_formal_arglist *f1, gfc_formal_arglist *f2, ...@@ -1206,7 +1206,7 @@ count_types_test (gfc_formal_arglist *f1, gfc_formal_arglist *f2,
At this point, 'CALL FOO(A=1, B=1.0)' is ambiguous. */ At this point, 'CALL FOO(A=1, B=1.0)' is ambiguous. */
static int static bool
generic_correspondence (gfc_formal_arglist *f1, gfc_formal_arglist *f2, generic_correspondence (gfc_formal_arglist *f1, gfc_formal_arglist *f2,
const char *p1, const char *p2) const char *p1, const char *p2)
{ {
...@@ -1244,7 +1244,7 @@ generic_correspondence (gfc_formal_arglist *f1, gfc_formal_arglist *f2, ...@@ -1244,7 +1244,7 @@ generic_correspondence (gfc_formal_arglist *f1, gfc_formal_arglist *f2,
|| ((gfc_option.allow_std & GFC_STD_F2008) || ((gfc_option.allow_std & GFC_STD_F2008)
&& ((sym->attr.allocatable && g->sym->attr.pointer) && ((sym->attr.allocatable && g->sym->attr.pointer)
|| (sym->attr.pointer && g->sym->attr.allocatable)))) || (sym->attr.pointer && g->sym->attr.allocatable))))
return 1; return true;
} }
next: next:
...@@ -1254,7 +1254,7 @@ generic_correspondence (gfc_formal_arglist *f1, gfc_formal_arglist *f2, ...@@ -1254,7 +1254,7 @@ generic_correspondence (gfc_formal_arglist *f1, gfc_formal_arglist *f2,
f2 = f2->next; f2 = f2->next;
} }
return 0; return false;
} }
...@@ -1638,13 +1638,13 @@ gfc_check_result_characteristics (gfc_symbol *s1, gfc_symbol *s2, ...@@ -1638,13 +1638,13 @@ gfc_check_result_characteristics (gfc_symbol *s1, gfc_symbol *s2,
/* 'Compare' two formal interfaces associated with a pair of symbols. /* 'Compare' two formal interfaces associated with a pair of symbols.
We return nonzero if there exists an actual argument list that We return true if there exists an actual argument list that
would be ambiguous between the two interfaces, zero otherwise. would be ambiguous between the two interfaces, zero otherwise.
'strict_flag' specifies whether all the characteristics are 'strict_flag' specifies whether all the characteristics are
required to match, which is not the case for ambiguity checks. required to match, which is not the case for ambiguity checks.
'p1' and 'p2' are the PASS arguments of both procedures (if applicable). */ 'p1' and 'p2' are the PASS arguments of both procedures (if applicable). */
int bool
gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, const char *name2, gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, const char *name2,
int generic_flag, int strict_flag, int generic_flag, int strict_flag,
char *errmsg, int err_len, char *errmsg, int err_len,
...@@ -1660,14 +1660,14 @@ gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, const char *name2, ...@@ -1660,14 +1660,14 @@ gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, const char *name2,
{ {
if (errmsg != NULL) if (errmsg != NULL)
snprintf (errmsg, err_len, "'%s' is not a function", name2); snprintf (errmsg, err_len, "'%s' is not a function", name2);
return 0; return false;
} }
if (s1->attr.subroutine && s2->attr.function) if (s1->attr.subroutine && s2->attr.function)
{ {
if (errmsg != NULL) if (errmsg != NULL)
snprintf (errmsg, err_len, "'%s' is not a subroutine", name2); snprintf (errmsg, err_len, "'%s' is not a subroutine", name2);
return 0; return false;
} }
/* Do strict checks on all characteristics /* Do strict checks on all characteristics
...@@ -1679,48 +1679,48 @@ gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, const char *name2, ...@@ -1679,48 +1679,48 @@ gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, const char *name2,
/* If both are functions, check result characteristics. */ /* If both are functions, check result characteristics. */
if (!gfc_check_result_characteristics (s1, s2, errmsg, err_len) if (!gfc_check_result_characteristics (s1, s2, errmsg, err_len)
|| !gfc_check_result_characteristics (s2, s1, errmsg, err_len)) || !gfc_check_result_characteristics (s2, s1, errmsg, err_len))
return 0; return false;
} }
if (s1->attr.pure && !s2->attr.pure) if (s1->attr.pure && !s2->attr.pure)
{ {
snprintf (errmsg, err_len, "Mismatch in PURE attribute"); snprintf (errmsg, err_len, "Mismatch in PURE attribute");
return 0; return false;
} }
if (s1->attr.elemental && !s2->attr.elemental) if (s1->attr.elemental && !s2->attr.elemental)
{ {
snprintf (errmsg, err_len, "Mismatch in ELEMENTAL attribute"); snprintf (errmsg, err_len, "Mismatch in ELEMENTAL attribute");
return 0; return false;
} }
} }
if (s1->attr.if_source == IFSRC_UNKNOWN if (s1->attr.if_source == IFSRC_UNKNOWN
|| s2->attr.if_source == IFSRC_UNKNOWN) || s2->attr.if_source == IFSRC_UNKNOWN)
return 1; return true;
f1 = gfc_sym_get_dummy_args (s1); f1 = gfc_sym_get_dummy_args (s1);
f2 = gfc_sym_get_dummy_args (s2); f2 = gfc_sym_get_dummy_args (s2);
/* Special case: No arguments. */ /* Special case: No arguments. */
if (f1 == NULL && f2 == NULL) if (f1 == NULL && f2 == NULL)
return 1; return true;
if (generic_flag) if (generic_flag)
{ {
if (count_types_test (f1, f2, p1, p2) if (count_types_test (f1, f2, p1, p2)
|| count_types_test (f2, f1, p2, p1)) || count_types_test (f2, f1, p2, p1))
return 0; return false;
/* Special case: alternate returns. If both f1->sym and f2->sym are /* Special case: alternate returns. If both f1->sym and f2->sym are
NULL, then the leading formal arguments are alternate returns. NULL, then the leading formal arguments are alternate returns.
The previous conditional should catch argument lists with The previous conditional should catch argument lists with
different number of argument. */ different number of argument. */
if (f1 && f1->sym == NULL && f2 && f2->sym == NULL) if (f1 && f1->sym == NULL && f2 && f2->sym == NULL)
return 1; return true;
if (generic_correspondence (f1, f2, p1, p2) if (generic_correspondence (f1, f2, p1, p2)
|| generic_correspondence (f2, f1, p2, p1)) || generic_correspondence (f2, f1, p2, p1))
return 0; return false;
} }
else else
/* Perform the abbreviated correspondence test for operators (the /* Perform the abbreviated correspondence test for operators (the
...@@ -1736,7 +1736,7 @@ gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, const char *name2, ...@@ -1736,7 +1736,7 @@ gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, const char *name2,
if (errmsg != NULL) if (errmsg != NULL)
snprintf (errmsg, err_len, "'%s' has the wrong number of " snprintf (errmsg, err_len, "'%s' has the wrong number of "
"arguments", name2); "arguments", name2);
return 0; return false;
} }
if (strict_flag) if (strict_flag)
...@@ -1744,7 +1744,7 @@ gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, const char *name2, ...@@ -1744,7 +1744,7 @@ gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, const char *name2,
/* Check all characteristics. */ /* Check all characteristics. */
if (!gfc_check_dummy_characteristics (f1->sym, f2->sym, true, if (!gfc_check_dummy_characteristics (f1->sym, f2->sym, true,
errmsg, err_len)) errmsg, err_len))
return 0; return false;
} }
else else
{ {
...@@ -1756,7 +1756,7 @@ gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, const char *name2, ...@@ -1756,7 +1756,7 @@ gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, const char *name2,
"(%s/%s)", f1->sym->name, "(%s/%s)", f1->sym->name,
gfc_typename (&f1->sym->ts), gfc_typename (&f1->sym->ts),
gfc_typename (&f2->sym->ts)); gfc_typename (&f2->sym->ts));
return 0; return false;
} }
if (!compare_rank (f2->sym, f1->sym)) if (!compare_rank (f2->sym, f1->sym))
{ {
...@@ -1764,21 +1764,21 @@ gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, const char *name2, ...@@ -1764,21 +1764,21 @@ gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, const char *name2,
snprintf (errmsg, err_len, "Rank mismatch in argument '%s' " snprintf (errmsg, err_len, "Rank mismatch in argument '%s' "
"(%i/%i)", f1->sym->name, symbol_rank (f1->sym), "(%i/%i)", f1->sym->name, symbol_rank (f1->sym),
symbol_rank (f2->sym)); symbol_rank (f2->sym));
return 0; return false;
} }
} }
} }
return 1; return true;
} }
/* Given a pointer to an interface pointer, remove duplicate /* Given a pointer to an interface pointer, remove duplicate
interfaces and make sure that all symbols are either functions interfaces and make sure that all symbols are either functions
or subroutines, and all of the same kind. Returns nonzero if or subroutines, and all of the same kind. Returns true if
something goes wrong. */ something goes wrong. */
static int static bool
check_interface0 (gfc_interface *p, const char *interface_name) check_interface0 (gfc_interface *p, const char *interface_name)
{ {
gfc_interface *psave, *q, *qlast; gfc_interface *psave, *q, *qlast;
...@@ -1799,7 +1799,7 @@ check_interface0 (gfc_interface *p, const char *interface_name) ...@@ -1799,7 +1799,7 @@ check_interface0 (gfc_interface *p, const char *interface_name)
gfc_error ("Procedure %qs in %s at %L is neither function nor " gfc_error ("Procedure %qs in %s at %L is neither function nor "
"subroutine", p->sym->name, interface_name, "subroutine", p->sym->name, interface_name,
&p->sym->declared_at); &p->sym->declared_at);
return 1; return true;
} }
/* Verify that procedures are either all SUBROUTINEs or all FUNCTIONs. */ /* Verify that procedures are either all SUBROUTINEs or all FUNCTIONs. */
...@@ -1815,7 +1815,7 @@ check_interface0 (gfc_interface *p, const char *interface_name) ...@@ -1815,7 +1815,7 @@ check_interface0 (gfc_interface *p, const char *interface_name)
gfc_error ("In %s at %L procedures must be all FUNCTIONs as the " gfc_error ("In %s at %L procedures must be all FUNCTIONs as the "
"generic name is also the name of a derived type", "generic name is also the name of a derived type",
interface_name, &p->sym->declared_at); interface_name, &p->sym->declared_at);
return 1; return true;
} }
/* F2003, C1207. F2008, C1207. */ /* F2003, C1207. F2008, C1207. */
...@@ -1823,7 +1823,7 @@ check_interface0 (gfc_interface *p, const char *interface_name) ...@@ -1823,7 +1823,7 @@ check_interface0 (gfc_interface *p, const char *interface_name)
&& !gfc_notify_std (GFC_STD_F2008, "Internal procedure " && !gfc_notify_std (GFC_STD_F2008, "Internal procedure "
"%qs in %s at %L", p->sym->name, "%qs in %s at %L", p->sym->name,
interface_name, &p->sym->declared_at)) interface_name, &p->sym->declared_at))
return 1; return true;
} }
p = psave; p = psave;
...@@ -1849,14 +1849,14 @@ check_interface0 (gfc_interface *p, const char *interface_name) ...@@ -1849,14 +1849,14 @@ check_interface0 (gfc_interface *p, const char *interface_name)
} }
} }
return 0; return false;
} }
/* Check lists of interfaces to make sure that no two interfaces are /* Check lists of interfaces to make sure that no two interfaces are
ambiguous. Duplicate interfaces (from the same symbol) are OK here. */ ambiguous. Duplicate interfaces (from the same symbol) are OK here. */
static int static bool
check_interface1 (gfc_interface *p, gfc_interface *q0, check_interface1 (gfc_interface *p, gfc_interface *q0,
int generic_flag, const char *interface_name, int generic_flag, const char *interface_name,
bool referenced) bool referenced)
...@@ -1889,10 +1889,10 @@ check_interface1 (gfc_interface *p, gfc_interface *q0, ...@@ -1889,10 +1889,10 @@ check_interface1 (gfc_interface *p, gfc_interface *q0,
else else
gfc_warning (0, "Although not referenced, %qs has ambiguous " gfc_warning (0, "Although not referenced, %qs has ambiguous "
"interfaces at %L", interface_name, &p->where); "interfaces at %L", interface_name, &p->where);
return 1; return true;
} }
} }
return 0; return false;
} }
...@@ -2070,9 +2070,9 @@ done: ...@@ -2070,9 +2070,9 @@ done:
/* Given a symbol of a formal argument list and an expression, if the /* Given a symbol of a formal argument list and an expression, if the
formal argument is allocatable, check that the actual argument is formal argument is allocatable, check that the actual argument is
allocatable. Returns nonzero if compatible, zero if not compatible. */ allocatable. Returns true if compatible, zero if not compatible. */
static int static bool
compare_allocatable (gfc_symbol *formal, gfc_expr *actual) compare_allocatable (gfc_symbol *formal, gfc_expr *actual)
{ {
if (formal->attr.allocatable if (formal->attr.allocatable
...@@ -2080,12 +2080,12 @@ compare_allocatable (gfc_symbol *formal, gfc_expr *actual) ...@@ -2080,12 +2080,12 @@ compare_allocatable (gfc_symbol *formal, gfc_expr *actual)
{ {
symbol_attribute attr = gfc_expr_attr (actual); symbol_attribute attr = gfc_expr_attr (actual);
if (actual->ts.type == BT_CLASS && !attr.class_ok) if (actual->ts.type == BT_CLASS && !attr.class_ok)
return 1; return true;
else if (!attr.allocatable) else if (!attr.allocatable)
return 0; return false;
} }
return 1; return true;
} }
...@@ -2148,10 +2148,10 @@ argument_rank_mismatch (const char *name, locus *where, ...@@ -2148,10 +2148,10 @@ argument_rank_mismatch (const char *name, locus *where,
/* Given a symbol of a formal argument list and an expression, see if /* Given a symbol of a formal argument list and an expression, see if
the two are compatible as arguments. Returns nonzero if the two are compatible as arguments. Returns true if
compatible, zero if not compatible. */ compatible, false if not compatible. */
static int static bool
compare_parameter (gfc_symbol *formal, gfc_expr *actual, compare_parameter (gfc_symbol *formal, gfc_expr *actual,
int ranks_must_agree, int is_elemental, locus *where) int ranks_must_agree, int is_elemental, locus *where)
{ {
...@@ -2164,13 +2164,13 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2164,13 +2164,13 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
procs c_f_pointer or c_f_procpointer, and we need to accept most procs c_f_pointer or c_f_procpointer, and we need to accept most
pointers the user could give us. This should allow that. */ pointers the user could give us. This should allow that. */
if (formal->ts.type == BT_VOID) if (formal->ts.type == BT_VOID)
return 1; return true;
if (formal->ts.type == BT_DERIVED if (formal->ts.type == BT_DERIVED
&& formal->ts.u.derived && formal->ts.u.derived->ts.is_iso_c && formal->ts.u.derived && formal->ts.u.derived->ts.is_iso_c
&& actual->ts.type == BT_DERIVED && actual->ts.type == BT_DERIVED
&& actual->ts.u.derived && actual->ts.u.derived->ts.is_iso_c) && actual->ts.u.derived && actual->ts.u.derived->ts.is_iso_c)
return 1; return true;
if (formal->ts.type == BT_CLASS && actual->ts.type == BT_DERIVED) if (formal->ts.type == BT_CLASS && actual->ts.type == BT_DERIVED)
/* Make sure the vtab symbol is present when /* Make sure the vtab symbol is present when
...@@ -2185,7 +2185,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2185,7 +2185,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
{ {
if (where) if (where)
gfc_error ("Invalid procedure argument at %L", &actual->where); gfc_error ("Invalid procedure argument at %L", &actual->where);
return 0; return false;
} }
if (!gfc_compare_interfaces (formal, act_sym, act_sym->name, 0, 1, err, if (!gfc_compare_interfaces (formal, act_sym, act_sym->name, 0, 1, err,
...@@ -2195,7 +2195,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2195,7 +2195,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
gfc_error (OPT_Wargument_mismatch, gfc_error (OPT_Wargument_mismatch,
"Interface mismatch in dummy procedure %qs at %L: %s", "Interface mismatch in dummy procedure %qs at %L: %s",
formal->name, &actual->where, err); formal->name, &actual->where, err);
return 0; return false;
} }
if (formal->attr.function && !act_sym->attr.function) if (formal->attr.function && !act_sym->attr.function)
...@@ -2204,13 +2204,13 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2204,13 +2204,13 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
&act_sym->declared_at); &act_sym->declared_at);
if (act_sym->ts.type == BT_UNKNOWN if (act_sym->ts.type == BT_UNKNOWN
&& !gfc_set_default_type (act_sym, 1, act_sym->ns)) && !gfc_set_default_type (act_sym, 1, act_sym->ns))
return 0; return false;
} }
else if (formal->attr.subroutine && !act_sym->attr.subroutine) else if (formal->attr.subroutine && !act_sym->attr.subroutine)
gfc_add_subroutine (&act_sym->attr, act_sym->name, gfc_add_subroutine (&act_sym->attr, act_sym->name,
&act_sym->declared_at); &act_sym->declared_at);
return 1; return true;
} }
ppc = gfc_get_proc_ptr_comp (actual); ppc = gfc_get_proc_ptr_comp (actual);
...@@ -2223,7 +2223,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2223,7 +2223,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
gfc_error (OPT_Wargument_mismatch, gfc_error (OPT_Wargument_mismatch,
"Interface mismatch in dummy procedure %qs at %L: %s", "Interface mismatch in dummy procedure %qs at %L: %s",
formal->name, &actual->where, err); formal->name, &actual->where, err);
return 0; return false;
} }
} }
...@@ -2234,12 +2234,12 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2234,12 +2234,12 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
if (where) if (where)
gfc_error ("Actual argument to contiguous pointer dummy %qs at %L " gfc_error ("Actual argument to contiguous pointer dummy %qs at %L "
"must be simply contiguous", formal->name, &actual->where); "must be simply contiguous", formal->name, &actual->where);
return 0; return false;
} }
symbol_attribute actual_attr = gfc_expr_attr (actual); symbol_attribute actual_attr = gfc_expr_attr (actual);
if (actual->ts.type == BT_CLASS && !actual_attr.class_ok) if (actual->ts.type == BT_CLASS && !actual_attr.class_ok)
return 1; return true;
if ((actual->expr_type != EXPR_NULL || actual->ts.type != BT_UNKNOWN) if ((actual->expr_type != EXPR_NULL || actual->ts.type != BT_UNKNOWN)
&& actual->ts.type != BT_HOLLERITH && actual->ts.type != BT_HOLLERITH
...@@ -2255,7 +2255,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2255,7 +2255,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
"Type mismatch in argument %qs at %L; passed %s to %s", "Type mismatch in argument %qs at %L; passed %s to %s",
formal->name, where, gfc_typename (&actual->ts), formal->name, where, gfc_typename (&actual->ts),
gfc_typename (&formal->ts)); gfc_typename (&formal->ts));
return 0; return false;
} }
if (actual->ts.type == BT_ASSUMED && formal->ts.type != BT_ASSUMED) if (actual->ts.type == BT_ASSUMED && formal->ts.type != BT_ASSUMED)
...@@ -2264,7 +2264,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2264,7 +2264,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
gfc_error ("Assumed-type actual argument at %L requires that dummy " gfc_error ("Assumed-type actual argument at %L requires that dummy "
"argument %qs is of assumed type", &actual->where, "argument %qs is of assumed type", &actual->where,
formal->name); formal->name);
return 0; return false;
} }
/* F2008, 12.5.2.5; IR F08/0073. */ /* F2008, 12.5.2.5; IR F08/0073. */
...@@ -2279,7 +2279,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2279,7 +2279,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
if (where) if (where)
gfc_error ("Actual argument to %qs at %L must be polymorphic", gfc_error ("Actual argument to %qs at %L must be polymorphic",
formal->name, &actual->where); formal->name, &actual->where);
return 0; return false;
} }
if ((!UNLIMITED_POLY (formal) || !UNLIMITED_POLY(actual)) if ((!UNLIMITED_POLY (formal) || !UNLIMITED_POLY(actual))
...@@ -2289,7 +2289,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2289,7 +2289,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
if (where) if (where)
gfc_error ("Actual argument to %qs at %L must have the same " gfc_error ("Actual argument to %qs at %L must have the same "
"declared type", formal->name, &actual->where); "declared type", formal->name, &actual->where);
return 0; return false;
} }
} }
...@@ -2307,7 +2307,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2307,7 +2307,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
"pointer or allocatable unlimited polymorphic " "pointer or allocatable unlimited polymorphic "
"entity [F2008: 12.5.2.5]", formal->name, "entity [F2008: 12.5.2.5]", formal->name,
&actual->where); &actual->where);
return 0; return false;
} }
if (formal->attr.codimension && !gfc_is_coarray (actual)) if (formal->attr.codimension && !gfc_is_coarray (actual))
...@@ -2315,7 +2315,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2315,7 +2315,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
if (where) if (where)
gfc_error ("Actual argument to %qs at %L must be a coarray", gfc_error ("Actual argument to %qs at %L must be a coarray",
formal->name, &actual->where); formal->name, &actual->where);
return 0; return false;
} }
if (formal->attr.codimension && formal->attr.allocatable) if (formal->attr.codimension && formal->attr.allocatable)
...@@ -2336,7 +2336,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2336,7 +2336,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
formal->name, &actual->where, formal->as->corank, formal->name, &actual->where, formal->as->corank,
last ? last->u.c.component->as->corank last ? last->u.c.component->as->corank
: actual->symtree->n.sym->as->corank); : actual->symtree->n.sym->as->corank);
return 0; return false;
} }
} }
...@@ -2353,7 +2353,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2353,7 +2353,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
gfc_error ("Actual argument to %qs at %L must be simply " gfc_error ("Actual argument to %qs at %L must be simply "
"contiguous or an element of such an array", "contiguous or an element of such an array",
formal->name, &actual->where); formal->name, &actual->where);
return 0; return false;
} }
/* F2008, C1303 and C1304. */ /* F2008, C1303 and C1304. */
...@@ -2368,7 +2368,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2368,7 +2368,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
gfc_error ("Actual argument to non-INTENT(INOUT) dummy %qs at %L, " gfc_error ("Actual argument to non-INTENT(INOUT) dummy %qs at %L, "
"which is LOCK_TYPE or has a LOCK_TYPE component", "which is LOCK_TYPE or has a LOCK_TYPE component",
formal->name, &actual->where); formal->name, &actual->where);
return 0; return false;
} }
/* TS18508, C702/C703. */ /* TS18508, C702/C703. */
...@@ -2383,7 +2383,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2383,7 +2383,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
gfc_error ("Actual argument to non-INTENT(INOUT) dummy %qs at %L, " gfc_error ("Actual argument to non-INTENT(INOUT) dummy %qs at %L, "
"which is EVENT_TYPE or has a EVENT_TYPE component", "which is EVENT_TYPE or has a EVENT_TYPE component",
formal->name, &actual->where); formal->name, &actual->where);
return 0; return false;
} }
} }
...@@ -2403,7 +2403,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2403,7 +2403,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
"assumed-rank array without CONTIGUOUS attribute - as actual" "assumed-rank array without CONTIGUOUS attribute - as actual"
" argument at %L is not simply contiguous and both are " " argument at %L is not simply contiguous and both are "
"ASYNCHRONOUS or VOLATILE", formal->name, &actual->where); "ASYNCHRONOUS or VOLATILE", formal->name, &actual->where);
return 0; return false;
} }
if (formal->attr.allocatable && !formal->attr.codimension if (formal->attr.allocatable && !formal->attr.codimension
...@@ -2415,7 +2415,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2415,7 +2415,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
gfc_error ("Passing coarray at %L to allocatable, noncoarray, " gfc_error ("Passing coarray at %L to allocatable, noncoarray, "
"INTENT(OUT) dummy argument %qs", &actual->where, "INTENT(OUT) dummy argument %qs", &actual->where,
formal->name); formal->name);
return 0; return false;
} }
else if (warn_surprising && where && formal->attr.intent != INTENT_IN) else if (warn_surprising && where && formal->attr.intent != INTENT_IN)
gfc_warning (OPT_Wsurprising, gfc_warning (OPT_Wsurprising,
...@@ -2426,7 +2426,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2426,7 +2426,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
/* If the rank is the same or the formal argument has assumed-rank. */ /* If the rank is the same or the formal argument has assumed-rank. */
if (symbol_rank (formal) == actual->rank || symbol_rank (formal) == -1) if (symbol_rank (formal) == actual->rank || symbol_rank (formal) == -1)
return 1; return true;
rank_check = where != NULL && !is_elemental && formal->as rank_check = where != NULL && !is_elemental && formal->as
&& (formal->as->type == AS_ASSUMED_SHAPE && (formal->as->type == AS_ASSUMED_SHAPE
...@@ -2435,7 +2435,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2435,7 +2435,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
/* Skip rank checks for NO_ARG_CHECK. */ /* Skip rank checks for NO_ARG_CHECK. */
if (formal->attr.ext_attr & (1 << EXT_ATTR_NO_ARG_CHECK)) if (formal->attr.ext_attr & (1 << EXT_ATTR_NO_ARG_CHECK))
return 1; return true;
/* Scalar & coindexed, see: F2008, Section 12.5.2.4. */ /* Scalar & coindexed, see: F2008, Section 12.5.2.4. */
if (rank_check || ranks_must_agree if (rank_check || ranks_must_agree
...@@ -2453,10 +2453,10 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2453,10 +2453,10 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
if (where) if (where)
argument_rank_mismatch (formal->name, &actual->where, argument_rank_mismatch (formal->name, &actual->where,
symbol_rank (formal), actual->rank); symbol_rank (formal), actual->rank);
return 0; return false;
} }
else if (actual->rank != 0 && (is_elemental || formal->attr.dimension)) else if (actual->rank != 0 && (is_elemental || formal->attr.dimension))
return 1; return true;
/* At this point, we are considering a scalar passed to an array. This /* At this point, we are considering a scalar passed to an array. This
is valid (cf. F95 12.4.1.1, F2003 12.4.1.2, and F2008 12.5.2.4), is valid (cf. F95 12.4.1.1, F2003 12.4.1.2, and F2008 12.5.2.4),
...@@ -2484,7 +2484,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2484,7 +2484,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
if (where) if (where)
gfc_error ("Polymorphic scalar passed to array dummy argument %qs " gfc_error ("Polymorphic scalar passed to array dummy argument %qs "
"at %L", formal->name, &actual->where); "at %L", formal->name, &actual->where);
return 0; return false;
} }
if (actual->expr_type != EXPR_NULL && ref && actual->ts.type != BT_CHARACTER if (actual->expr_type != EXPR_NULL && ref && actual->ts.type != BT_CHARACTER
...@@ -2494,7 +2494,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2494,7 +2494,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
gfc_error ("Element of assumed-shaped or pointer " gfc_error ("Element of assumed-shaped or pointer "
"array passed to array dummy argument %qs at %L", "array passed to array dummy argument %qs at %L",
formal->name, &actual->where); formal->name, &actual->where);
return 0; return false;
} }
if (actual->ts.type == BT_CHARACTER && actual->expr_type != EXPR_NULL if (actual->ts.type == BT_CHARACTER && actual->expr_type != EXPR_NULL
...@@ -2506,7 +2506,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2506,7 +2506,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
gfc_error ("Extension: Scalar non-default-kind, non-C_CHAR-kind " gfc_error ("Extension: Scalar non-default-kind, non-C_CHAR-kind "
"CHARACTER actual argument with array dummy argument " "CHARACTER actual argument with array dummy argument "
"%qs at %L", formal->name, &actual->where); "%qs at %L", formal->name, &actual->where);
return 0; return false;
} }
if (where && (gfc_option.allow_std & GFC_STD_F2003) == 0) if (where && (gfc_option.allow_std & GFC_STD_F2003) == 0)
...@@ -2514,12 +2514,10 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2514,12 +2514,10 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
gfc_error ("Fortran 2003: Scalar CHARACTER actual argument with " gfc_error ("Fortran 2003: Scalar CHARACTER actual argument with "
"array dummy argument %qs at %L", "array dummy argument %qs at %L",
formal->name, &actual->where); formal->name, &actual->where);
return 0; return false;
} }
else if ((gfc_option.allow_std & GFC_STD_F2003) == 0)
return 0;
else else
return 1; return ((gfc_option.allow_std & GFC_STD_F2003) != 0);
} }
if (ref == NULL && actual->expr_type != EXPR_NULL) if (ref == NULL && actual->expr_type != EXPR_NULL)
...@@ -2527,10 +2525,10 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, ...@@ -2527,10 +2525,10 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
if (where) if (where)
argument_rank_mismatch (formal->name, &actual->where, argument_rank_mismatch (formal->name, &actual->where,
symbol_rank (formal), actual->rank); symbol_rank (formal), actual->rank);
return 0; return false;
} }
return 1; return true;
} }
...@@ -2754,25 +2752,24 @@ get_expr_storage_size (gfc_expr *e) ...@@ -2754,25 +2752,24 @@ get_expr_storage_size (gfc_expr *e)
/* Given an expression, check whether it is an array section /* Given an expression, check whether it is an array section
which has a vector subscript. If it has, one is returned, which has a vector subscript. */
otherwise zero. */
int bool
gfc_has_vector_subscript (gfc_expr *e) gfc_has_vector_subscript (gfc_expr *e)
{ {
int i; int i;
gfc_ref *ref; gfc_ref *ref;
if (e == NULL || e->rank == 0 || e->expr_type != EXPR_VARIABLE) if (e == NULL || e->rank == 0 || e->expr_type != EXPR_VARIABLE)
return 0; return false;
for (ref = e->ref; ref; ref = ref->next) for (ref = e->ref; ref; ref = ref->next)
if (ref->type == REF_ARRAY && ref->u.ar.type == AR_SECTION) if (ref->type == REF_ARRAY && ref->u.ar.type == AR_SECTION)
for (i = 0; i < ref->u.ar.dimen; i++) for (i = 0; i < ref->u.ar.dimen; i++)
if (ref->u.ar.dimen_type[i] == DIMEN_VECTOR) if (ref->u.ar.dimen_type[i] == DIMEN_VECTOR)
return 1; return true;
return 0; return false;
} }
...@@ -2795,7 +2792,7 @@ is_procptr_result (gfc_expr *expr) ...@@ -2795,7 +2792,7 @@ is_procptr_result (gfc_expr *expr)
errors when things don't match instead of just returning the status errors when things don't match instead of just returning the status
code. */ code. */
static int static bool
compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
int ranks_must_agree, int is_elemental, locus *where) int ranks_must_agree, int is_elemental, locus *where)
{ {
...@@ -2809,7 +2806,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -2809,7 +2806,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
actual = *ap; actual = *ap;
if (actual == NULL && formal == NULL) if (actual == NULL && formal == NULL)
return 1; return true;
n = 0; n = 0;
for (f = formal; f; f = f->next) for (f = formal; f; f = f->next)
...@@ -2843,7 +2840,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -2843,7 +2840,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
if (where) if (where)
gfc_error ("Keyword argument %qs at %L is not in " gfc_error ("Keyword argument %qs at %L is not in "
"the procedure", a->name, &a->expr->where); "the procedure", a->name, &a->expr->where);
return 0; return false;
} }
if (new_arg[i] != NULL) if (new_arg[i] != NULL)
...@@ -2852,7 +2849,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -2852,7 +2849,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
gfc_error ("Keyword argument %qs at %L is already associated " gfc_error ("Keyword argument %qs at %L is already associated "
"with another actual argument", a->name, "with another actual argument", a->name,
&a->expr->where); &a->expr->where);
return 0; return false;
} }
} }
...@@ -2862,7 +2859,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -2862,7 +2859,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
gfc_error ("More actual than formal arguments in procedure " gfc_error ("More actual than formal arguments in procedure "
"call at %L", where); "call at %L", where);
return 0; return false;
} }
if (f->sym == NULL && a->expr == NULL) if (f->sym == NULL && a->expr == NULL)
...@@ -2873,7 +2870,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -2873,7 +2870,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
if (where) if (where)
gfc_error ("Missing alternate return spec in subroutine call " gfc_error ("Missing alternate return spec in subroutine call "
"at %L", where); "at %L", where);
return 0; return false;
} }
if (a->expr == NULL) if (a->expr == NULL)
...@@ -2881,7 +2878,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -2881,7 +2878,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
if (where) if (where)
gfc_error ("Unexpected alternate return spec in subroutine " gfc_error ("Unexpected alternate return spec in subroutine "
"call at %L", where); "call at %L", where);
return 0; return false;
} }
/* Make sure that intrinsic vtables exist for calls to unlimited /* Make sure that intrinsic vtables exist for calls to unlimited
...@@ -2912,12 +2909,12 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -2912,12 +2909,12 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
gfc_error ("Fortran 2008: Null pointer at %L to non-pointer " gfc_error ("Fortran 2008: Null pointer at %L to non-pointer "
"dummy %qs", where, f->sym->name); "dummy %qs", where, f->sym->name);
return 0; return false;
} }
if (!compare_parameter (f->sym, a->expr, ranks_must_agree, if (!compare_parameter (f->sym, a->expr, ranks_must_agree,
is_elemental, where)) is_elemental, where))
return 0; return false;
/* TS 29113, 6.3p2. */ /* TS 29113, 6.3p2. */
if (f->sym->ts.type == BT_ASSUMED if (f->sym->ts.type == BT_ASSUMED
...@@ -2970,7 +2967,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -2970,7 +2967,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
mpz_get_si (a->expr->ts.u.cl->length->value.integer), mpz_get_si (a->expr->ts.u.cl->length->value.integer),
mpz_get_si (f->sym->ts.u.cl->length->value.integer), mpz_get_si (f->sym->ts.u.cl->length->value.integer),
f->sym->name, &a->expr->where); f->sym->name, &a->expr->where);
return 0; return false;
} }
if ((f->sym->attr.pointer || f->sym->attr.allocatable) if ((f->sym->attr.pointer || f->sym->attr.allocatable)
...@@ -2982,7 +2979,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -2982,7 +2979,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
"pointer dummy argument %qs must have a deferred " "pointer dummy argument %qs must have a deferred "
"length type parameter if and only if the dummy has one", "length type parameter if and only if the dummy has one",
&a->expr->where, f->sym->name); &a->expr->where, f->sym->name);
return 0; return false;
} }
if (f->sym->ts.type == BT_CLASS) if (f->sym->ts.type == BT_CLASS)
...@@ -3006,7 +3003,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -3006,7 +3003,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
"elements for dummy argument %qs (%lu/%lu) at %L", "elements for dummy argument %qs (%lu/%lu) at %L",
f->sym->name, actual_size, formal_size, f->sym->name, actual_size, formal_size,
&a->expr->where); &a->expr->where);
return 0; return false;
} }
skip_size_check: skip_size_check:
...@@ -3023,7 +3020,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -3023,7 +3020,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
if (where) if (where)
gfc_error ("Expected a procedure pointer for argument %qs at %L", gfc_error ("Expected a procedure pointer for argument %qs at %L",
f->sym->name, &a->expr->where); f->sym->name, &a->expr->where);
return 0; return false;
} }
/* Satisfy F03:12.4.1.3 by ensuring that a procedure actual argument is /* Satisfy F03:12.4.1.3 by ensuring that a procedure actual argument is
...@@ -3039,7 +3036,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -3039,7 +3036,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
if (where) if (where)
gfc_error ("Expected a procedure for argument %qs at %L", gfc_error ("Expected a procedure for argument %qs at %L",
f->sym->name, &a->expr->where); f->sym->name, &a->expr->where);
return 0; return false;
} }
if (f->sym->as && f->sym->as->type == AS_ASSUMED_SHAPE if (f->sym->as && f->sym->as->type == AS_ASSUMED_SHAPE
...@@ -3053,7 +3050,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -3053,7 +3050,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
if (where) if (where)
gfc_error ("Actual argument for %qs cannot be an assumed-size" gfc_error ("Actual argument for %qs cannot be an assumed-size"
" array at %L", f->sym->name, where); " array at %L", f->sym->name, where);
return 0; return false;
} }
if (a->expr->expr_type != EXPR_NULL if (a->expr->expr_type != EXPR_NULL
...@@ -3062,7 +3059,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -3062,7 +3059,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
if (where) if (where)
gfc_error ("Actual argument for %qs must be a pointer at %L", gfc_error ("Actual argument for %qs must be a pointer at %L",
f->sym->name, &a->expr->where); f->sym->name, &a->expr->where);
return 0; return false;
} }
if (a->expr->expr_type != EXPR_NULL if (a->expr->expr_type != EXPR_NULL
...@@ -3072,7 +3069,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -3072,7 +3069,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
if (where) if (where)
gfc_error ("Fortran 2008: Non-pointer actual argument at %L to " gfc_error ("Fortran 2008: Non-pointer actual argument at %L to "
"pointer dummy %qs", &a->expr->where,f->sym->name); "pointer dummy %qs", &a->expr->where,f->sym->name);
return 0; return false;
} }
...@@ -3083,7 +3080,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -3083,7 +3080,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
gfc_error ("Coindexed actual argument at %L to pointer " gfc_error ("Coindexed actual argument at %L to pointer "
"dummy %qs", "dummy %qs",
&a->expr->where, f->sym->name); &a->expr->where, f->sym->name);
return 0; return false;
} }
/* Fortran 2008, 12.5.2.5 (no constraint). */ /* Fortran 2008, 12.5.2.5 (no constraint). */
...@@ -3096,7 +3093,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -3096,7 +3093,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
gfc_error ("Coindexed actual argument at %L to allocatable " gfc_error ("Coindexed actual argument at %L to allocatable "
"dummy %qs requires INTENT(IN)", "dummy %qs requires INTENT(IN)",
&a->expr->where, f->sym->name); &a->expr->where, f->sym->name);
return 0; return false;
} }
/* Fortran 2008, C1237. */ /* Fortran 2008, C1237. */
...@@ -3111,7 +3108,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -3111,7 +3108,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
"%L requires that dummy %qs has neither " "%L requires that dummy %qs has neither "
"ASYNCHRONOUS nor VOLATILE", &a->expr->where, "ASYNCHRONOUS nor VOLATILE", &a->expr->where,
f->sym->name); f->sym->name);
return 0; return false;
} }
/* Fortran 2008, 12.5.2.4 (no constraint). */ /* Fortran 2008, 12.5.2.4 (no constraint). */
...@@ -3124,7 +3121,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -3124,7 +3121,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
gfc_error ("Coindexed actual argument at %L with allocatable " gfc_error ("Coindexed actual argument at %L with allocatable "
"ultimate component to dummy %qs requires either VALUE " "ultimate component to dummy %qs requires either VALUE "
"or INTENT(IN)", &a->expr->where, f->sym->name); "or INTENT(IN)", &a->expr->where, f->sym->name);
return 0; return false;
} }
if (f->sym->ts.type == BT_CLASS if (f->sym->ts.type == BT_CLASS
...@@ -3135,17 +3132,17 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -3135,17 +3132,17 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
if (where) if (where)
gfc_error ("Actual CLASS array argument for %qs must be a full " gfc_error ("Actual CLASS array argument for %qs must be a full "
"array at %L", f->sym->name, &a->expr->where); "array at %L", f->sym->name, &a->expr->where);
return 0; return false;
} }
if (a->expr->expr_type != EXPR_NULL if (a->expr->expr_type != EXPR_NULL
&& compare_allocatable (f->sym, a->expr) == 0) && !compare_allocatable (f->sym, a->expr))
{ {
if (where) if (where)
gfc_error ("Actual argument for %qs must be ALLOCATABLE at %L", gfc_error ("Actual argument for %qs must be ALLOCATABLE at %L",
f->sym->name, &a->expr->where); f->sym->name, &a->expr->where);
return 0; return false;
} }
/* Check intent = OUT/INOUT for definable actual argument. */ /* Check intent = OUT/INOUT for definable actual argument. */
...@@ -3160,9 +3157,9 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -3160,9 +3157,9 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
&& CLASS_DATA (f->sym)->attr.class_pointer) && CLASS_DATA (f->sym)->attr.class_pointer)
|| (f->sym->ts.type != BT_CLASS && f->sym->attr.pointer)) || (f->sym->ts.type != BT_CLASS && f->sym->attr.pointer))
&& !gfc_check_vardef_context (a->expr, true, false, false, context)) && !gfc_check_vardef_context (a->expr, true, false, false, context))
return 0; return false;
if (!gfc_check_vardef_context (a->expr, false, false, false, context)) if (!gfc_check_vardef_context (a->expr, false, false, false, context))
return 0; return false;
} }
if ((f->sym->attr.intent == INTENT_OUT if ((f->sym->attr.intent == INTENT_OUT
...@@ -3177,7 +3174,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -3177,7 +3174,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
"INTENT(INOUT), VOLATILE or ASYNCHRONOUS attribute " "INTENT(INOUT), VOLATILE or ASYNCHRONOUS attribute "
"of the dummy argument %qs", "of the dummy argument %qs",
&a->expr->where, f->sym->name); &a->expr->where, f->sym->name);
return 0; return false;
} }
/* C1232 (R1221) For an actual argument which is an array section or /* C1232 (R1221) For an actual argument which is an array section or
...@@ -3195,7 +3192,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -3195,7 +3192,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
"incompatible with the non-assumed-shape " "incompatible with the non-assumed-shape "
"dummy argument %qs due to VOLATILE attribute", "dummy argument %qs due to VOLATILE attribute",
&a->expr->where,f->sym->name); &a->expr->where,f->sym->name);
return 0; return false;
} }
/* Find the last array_ref. */ /* Find the last array_ref. */
...@@ -3212,7 +3209,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -3212,7 +3209,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
"incompatible with the non-assumed-shape " "incompatible with the non-assumed-shape "
"dummy argument %qs due to VOLATILE attribute", "dummy argument %qs due to VOLATILE attribute",
&a->expr->where, f->sym->name); &a->expr->where, f->sym->name);
return 0; return false;
} }
/* C1233 (R1221) For an actual argument which is a pointer array, the /* C1233 (R1221) For an actual argument which is a pointer array, the
...@@ -3232,7 +3229,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -3232,7 +3229,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
"an assumed-shape or pointer-array dummy " "an assumed-shape or pointer-array dummy "
"argument %qs due to VOLATILE attribute", "argument %qs due to VOLATILE attribute",
&a->expr->where,f->sym->name); &a->expr->where,f->sym->name);
return 0; return false;
} }
match: match:
...@@ -3253,14 +3250,14 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -3253,14 +3250,14 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
if (where) if (where)
gfc_error ("Missing alternate return spec in subroutine call " gfc_error ("Missing alternate return spec in subroutine call "
"at %L", where); "at %L", where);
return 0; return false;
} }
if (!f->sym->attr.optional) if (!f->sym->attr.optional)
{ {
if (where) if (where)
gfc_error ("Missing actual argument for argument %qs at %L", gfc_error ("Missing actual argument for argument %qs at %L",
f->sym->name, where); f->sym->name, where);
return 0; return false;
} }
} }
...@@ -3290,7 +3287,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -3290,7 +3287,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
if (a->expr == NULL && a->label == NULL) if (a->expr == NULL && a->label == NULL)
a->missing_arg_type = f->sym->ts.type; a->missing_arg_type = f->sym->ts.type;
return 1; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment