[v2] Fortran: Narrow return types [PR78798]

Message ID 20230510164719.155783-1-rep.dot.nop@gmail.com
State Accepted
Headers
Series [v2] Fortran: Narrow return types [PR78798] |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Bernhard Reutner-Fischer May 10, 2023, 4:47 p.m. UTC
  From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>

gcc/fortran/ChangeLog:

	PR fortran/78798
	* array.cc (compare_bounds): Use narrower return type.
	(gfc_compare_array_spec): Likewise.
	(is_constant_element): Likewise.
	(gfc_constant_ac): Likewise.
	* check.cc (dim_rank_check): Likewise.
	* cpp.cc (gfc_cpp_init_options): Likewise.
	(dump_macro): Likewise.
	* cpp.h (gfc_cpp_handle_option): Likewise.
	* dependency.cc (gfc_ref_needs_temporary_p): Likewise.
	(gfc_check_argument_dependency): Likewise.
	(gfc_check_fncall_dependency): Likewise.
	(ref_same_as_full_array): Likewise.
	* dependency.h (gfc_check_fncall_dependency): Likewise.
	(gfc_dep_resolver): Likewise.
	(gfc_are_equivalenced_arrays): Likewise.
	* expr.cc (gfc_copy_ref): Likewise.
	(gfc_kind_max): Likewise.
	(numeric_type): Likewise.
	* gfortran.h (gfc_at_end): Likewise.
	(gfc_at_eof): Likewise.
	(gfc_at_bol): Likewise.
	(gfc_at_eol): Likewise.
	(gfc_define_undef_line): Likewise.
	(gfc_wide_is_printable): Likewise.
	(gfc_wide_is_digit): Likewise.
	(gfc_wide_fits_in_byte): Likewise.
	(gfc_find_sym_tree): Likewise.
	(gfc_generic_intrinsic): Likewise.
	(gfc_specific_intrinsic): Likewise.
	(gfc_intrinsic_actual_ok): Likewise.
	(gfc_has_vector_index): Likewise.
	(gfc_numeric_ts): Likewise.
	(gfc_impure_variable): Likewise.
	(gfc_pure): Likewise.
	(gfc_implicit_pure): Likewise.
	(gfc_elemental): Likewise.
	(gfc_pure_function): Likewise.
	(gfc_implicit_pure_function): Likewise.
	(gfc_compare_array_spec): Likewise.
	(gfc_constant_ac): Likewise.
	(gfc_expanded_ac): Likewise.
	(gfc_check_digit): Likewise.
	* intrinsic.cc (gfc_find_subroutine): Likewise.
	(gfc_generic_intrinsic): Likewise.
	(gfc_specific_intrinsic): Likewise.
	* io.cc (compare_to_allowed_values): Likewise. And remove
	unneeded forward declaration.
	* misc.cc (gfc_done_2): Likewise.
	* parse.cc: Likewise.
	* parse.h (gfc_check_do_variable): Likewise.
	* primary.cc (gfc_check_digit): Likewise.
	* resolve.cc (resolve_structure_cons): Likewise.
	(pure_stmt_function): Likewise.
	(gfc_pure_function): Likewise.
	(impure_stmt_fcn): Likewise.
	(resolve_forall_iterators): Likewise.
	(resolve_data): Likewise.
	(gfc_impure_variable): Likewise.
	(gfc_pure): Likewise.
	(gfc_unset_implicit_pure): Likewise.
	* scanner.cc (wide_is_ascii): Likewise.
	(gfc_wide_toupper): Likewise.
	(gfc_open_included_file): Likewise.
	(gfc_at_end): Likewise.
	(gfc_at_eof): Likewise.
	(gfc_at_bol): Likewise.
	(skip_comment_line): Likewise.
	(gfc_gobble_whitespace): Likewise.
	* symbol.cc (gfc_find_symtree_in_proc): Likewise.
	* trans-array.cc: Likewise.
	* trans-decl.cc (gfc_set_decl_assembler_name): Likewise.
	* trans-types.cc (gfc_get_element_type): Likewise.
	(gfc_add_field_to_struct): Likewise.
	* trans-types.h (gfc_copy_dt_decls_ifequal): Likewise.
	(gfc_return_by_reference): Likewise.
	(gfc_is_nodesc_array): Likewise.
	* trans.h (gfc_can_put_var_on_stack): Likewise.
---
Bootstrapped without new warnings and regression tested on
x86_64-linux with no regressions, OK for trunk?

 gcc/fortran/array.cc       |  8 +++----
 gcc/fortran/check.cc       |  2 +-
 gcc/fortran/cpp.cc         |  3 +--
 gcc/fortran/cpp.h          |  2 +-
 gcc/fortran/dependency.cc  |  8 +++----
 gcc/fortran/dependency.h   |  6 ++---
 gcc/fortran/expr.cc        |  6 ++---
 gcc/fortran/gfortran.h     | 48 +++++++++++++++++++-------------------
 gcc/fortran/intrinsic.cc   |  6 ++---
 gcc/fortran/io.cc          | 13 ++---------
 gcc/fortran/parse.cc       |  2 +-
 gcc/fortran/parse.h        |  2 +-
 gcc/fortran/primary.cc     |  4 ++--
 gcc/fortran/resolve.cc     | 22 ++++++++---------
 gcc/fortran/scanner.cc     | 20 ++++++++--------
 gcc/fortran/symbol.cc      |  2 +-
 gcc/fortran/trans-array.cc |  2 +-
 gcc/fortran/trans-decl.cc  |  2 +-
 gcc/fortran/trans-types.cc |  6 ++---
 gcc/fortran/trans-types.h  |  6 ++---
 gcc/fortran/trans.h        |  2 +-
 21 files changed, 81 insertions(+), 91 deletions(-)
  

Comments

Mikael Morin May 14, 2023, 12:27 p.m. UTC | #1
Le 10/05/2023 à 18:47, Bernhard Reutner-Fischer via Fortran a écrit :
> From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
> 
> gcc/fortran/ChangeLog:
> 
> 	PR fortran/78798
> 	* array.cc (compare_bounds): Use narrower return type.
> 	(gfc_compare_array_spec): Likewise.
> 	(is_constant_element): Likewise.
> 	(gfc_constant_ac): Likewise.
(...)
> ---
> Bootstrapped without new warnings and regression tested on
> x86_64-linux with no regressions, OK for trunk?
> 
(...)
> diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc
> index b348bda6e6c..4e3aed84b9d 100644
> --- a/gcc/fortran/check.cc
> +++ b/gcc/fortran/check.cc
> @@ -1156,7 +1156,7 @@ dim_rank_check (gfc_expr *dim, gfc_expr *array, int allow_assumed)
>      dimension bi, returning 0 if they are known not to be identical,
>      and 1 if they are identical, or if this cannot be determined.  */
>   
> -static int
> +static bool
>   identical_dimen_shape (gfc_expr *a, int ai, gfc_expr *b, int bi)
>   {
>     mpz_t a_size, b_size;

To be consistent, please change as well the local variable "ret" used as 
return value from int to bool.

> diff --git a/gcc/fortran/cpp.cc b/gcc/fortran/cpp.cc
> index c3b7c7f7bd9..d7890a97287 100644
> --- a/gcc/fortran/cpp.cc
> +++ b/gcc/fortran/cpp.cc
> @@ -297,7 +297,7 @@ gfc_cpp_init_options (unsigned int decoded_options_count,
>     gfc_cpp_option.deferred_opt_count = 0;
>   }
>   
> -int
> +bool
>   gfc_cpp_handle_option (size_t scode, const char *arg, int value ATTRIBUTE_UNUSED)
>   {
>     int result = 1;

Same here, change the type of variable "result".

(...)
> diff --git a/gcc/fortran/dependency.cc b/gcc/fortran/dependency.cc
> index a648d5c7903..b398b29a642 100644
> --- a/gcc/fortran/dependency.cc
> +++ b/gcc/fortran/dependency.cc
(...)

> @@ -1091,7 +1091,7 @@ gfc_check_argument_dependency (gfc_expr *other, sym_intent intent,
>   /* Like gfc_check_argument_dependency, but check all the arguments in ACTUAL.
>      FNSYM is the function being called, or NULL if not known.  */
>   
> -int
> +bool
>   gfc_check_fncall_dependency (gfc_expr *other, sym_intent intent,
>   			     gfc_symbol *fnsym, gfc_actual_arglist *actual,
>   			     gfc_dep_check elemental)

Why not change the associated subfunctions 
(gfc_check_argument_dependency, gfc_check_argument_var_dependency) as well ?

(...)
> @@ -2098,7 +2098,7 @@ ref_same_as_full_array (gfc_ref *full_ref, gfc_ref *ref)
>   	    there is some kind of overlap.
>   	0 : array references are identical or not overlapping.  */
>   
> -int
> +bool
>   gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse,
>   		  bool identical)
>   {

The function comment states that the function may return 2, which 
doesn't seem to be the case any more.  So please update the comment.

(...)> diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc
> index 221165d6dac..b4b36e27d75 100644
> --- a/gcc/fortran/symbol.cc
> +++ b/gcc/fortran/symbol.cc
> @@ -3216,7 +3216,7 @@ gfc_find_symtree_in_proc (const char* name, gfc_namespace* ns)
>      any parent namespaces if requested by a nonzero parent_flag.
>      Returns nonzero if the name is ambiguous.  */
>   
> -int
> +bool
>   gfc_find_sym_tree (const char *name, gfc_namespace *ns, int parent_flag,
>   		   gfc_symtree **result)
>   {

Maybe change nonzero to true in the comment?

(...)

OK with all the above fixed.

Thanks.
  
Thomas Koenig May 14, 2023, 1:04 p.m. UTC | #2
On 14.05.23 14:27, Mikael Morin wrote:
> 
> (...)
>> @@ -2098,7 +2098,7 @@ ref_same_as_full_array (gfc_ref *full_ref, 
>> gfc_ref *ref)
>>           there is some kind of overlap.
>>       0 : array references are identical or not overlapping.  */
>> -int
>> +bool
>>   gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse,
>>             bool identical)
>>   {
> 
> The function comment states that the function may return 2, which 
> doesn't seem to be the case any more.

Hm, this makes me a litte suspicious.  Was functionality for reversing
loops lost,  maybe unintentionally?  I assume that, at some time, we did
use the '2' as return value (or did we?)

Best regards

	Thomas
  
Bernhard Reutner-Fischer May 14, 2023, 3:24 p.m. UTC | #3
On Sun, 14 May 2023 15:04:15 +0200
Thomas Koenig <tkoenig@netcologne.de> wrote:

> On 14.05.23 14:27, Mikael Morin wrote:
> > 
> > (...)  
> >> @@ -2098,7 +2098,7 @@ ref_same_as_full_array (gfc_ref *full_ref, 
> >> gfc_ref *ref)
> >>           there is some kind of overlap.
> >>       0 : array references are identical or not overlapping.  */
> >> -int
> >> +bool
> >>   gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse,
> >>             bool identical)
> >>   {  
> > 
> > The function comment states that the function may return 2, which 
> > doesn't seem to be the case any more.  
> 
> Hm, this makes me a litte suspicious.  Was functionality for reversing
> loops lost,  maybe unintentionally?  I assume that, at some time, we did
> use the '2' as return value (or did we?)

There was 7c428aa29d75ef163c334cf3974f87b3630d8b8b (a revert because it
miscompiled spec2k) which might have associated the comment of the
former static gfc_dependency dep_ref (gfc_ref *lref, gfc_ref *rref,
gfc_reverse *reverse) to the current gfc_dep_resolver.

The commit which introduced the return value 2 documentation was
3d03ead0b8273efde57f6194617b35111a84b05d 
"re PR fortran/24524 (Fortran dependency checking should reverse loops)"

but TBH i don't see how it returned 2 in that revision?
Looks like when writing that patch it deemed useful to return 2 for
this specific situation but in the end it was dropped but the comment
survived.

I will update the comment to document the true / false return values.

And Mikael, do you want me to cleanup 1/0 to true/false assignments for
the boolean variables, or can we do that in a separate patch (or not at
all right now)?

many thanks for the reviews!
  
Mikael Morin May 14, 2023, 6:06 p.m. UTC | #4
Le 14/05/2023 à 17:24, Bernhard Reutner-Fischer a écrit :
> On Sun, 14 May 2023 15:04:15 +0200
> Thomas Koenig <tkoenig@netcologne.de> wrote:
> 
>> On 14.05.23 14:27, Mikael Morin wrote:
>>>
>>> (...)
>>>> @@ -2098,7 +2098,7 @@ ref_same_as_full_array (gfc_ref *full_ref,
>>>> gfc_ref *ref)
>>>>            there is some kind of overlap.
>>>>        0 : array references are identical or not overlapping.  */
>>>> -int
>>>> +bool
>>>>    gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse,
>>>>              bool identical)
>>>>    {
>>>
>>> The function comment states that the function may return 2, which
>>> doesn't seem to be the case any more.
>>
>> Hm, this makes me a litte suspicious.  Was functionality for reversing
>> loops lost,  maybe unintentionally?  I assume that, at some time, we did
>> use the '2' as return value (or did we?)
> 
> There was 7c428aa29d75ef163c334cf3974f87b3630d8b8b (a revert because it
> miscompiled spec2k) which might have associated the comment of the
> former static gfc_dependency dep_ref (gfc_ref *lref, gfc_ref *rref,
> gfc_reverse *reverse) to the current gfc_dep_resolver.
> 
> The commit which introduced the return value 2 documentation was
> 3d03ead0b8273efde57f6194617b35111a84b05d
> "re PR fortran/24524 (Fortran dependency checking should reverse loops)"
> 
> but TBH i don't see how it returned 2 in that revision?
> Looks like when writing that patch it deemed useful to return 2 for
> this specific situation but in the end it was dropped but the comment
> survived.
>
Yes, I came to the same conclusion that we never returned 2 here.

The information that reversal is needed is already provided on a per 
dimension basis by the gfc_reverse pointer passed as argument, so 
providing the information in the return value would be redundant anyway.


> I will update the comment to document the true / false return values.
> 
> And Mikael, do you want me to cleanup 1/0 to true/false assignments for
> the boolean variables, or can we do that in a separate patch (or not at
> all right now)?
> 
I don't mind too much either way.
As long as the variables are not assigned integer values outside of the 
[0,1] range, and we consistently use true/false or 0/1, not a mix of 
them, it's fine with me.
  
Bernhard Reutner-Fischer May 18, 2023, 7:52 p.m. UTC | #5
On Sun, 14 May 2023 14:27:42 +0200
Mikael Morin <morin-mikael@orange.fr> wrote:

> Le 10/05/2023 à 18:47, Bernhard Reutner-Fischer via Fortran a écrit :
> > From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
> > 
> > gcc/fortran/ChangeLog:
> > 
> > 	PR fortran/78798
> > 	* array.cc (compare_bounds): Use narrower return type.
> > 	(gfc_compare_array_spec): Likewise.
> > 	(is_constant_element): Likewise.
> > 	(gfc_constant_ac): Likewise.  
> (...)
> > ---
> > Bootstrapped without new warnings and regression tested on
> > x86_64-linux with no regressions, OK for trunk?
> >   
> (...)
> > diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc
> > index b348bda6e6c..4e3aed84b9d 100644
> > --- a/gcc/fortran/check.cc
> > +++ b/gcc/fortran/check.cc
> > @@ -1156,7 +1156,7 @@ dim_rank_check (gfc_expr *dim, gfc_expr *array, int allow_assumed)
> >      dimension bi, returning 0 if they are known not to be identical,
> >      and 1 if they are identical, or if this cannot be determined.  */
> >   
> > -static int
> > +static bool
> >   identical_dimen_shape (gfc_expr *a, int ai, gfc_expr *b, int bi)
> >   {
> >     mpz_t a_size, b_size;  
> 
> To be consistent, please change as well the local variable "ret" used as 
> return value from int to bool.
> 
> > diff --git a/gcc/fortran/cpp.cc b/gcc/fortran/cpp.cc
> > index c3b7c7f7bd9..d7890a97287 100644
> > --- a/gcc/fortran/cpp.cc
> > +++ b/gcc/fortran/cpp.cc
> > @@ -297,7 +297,7 @@ gfc_cpp_init_options (unsigned int decoded_options_count,
> >     gfc_cpp_option.deferred_opt_count = 0;
> >   }
> >   
> > -int
> > +bool
> >   gfc_cpp_handle_option (size_t scode, const char *arg, int value ATTRIBUTE_UNUSED)
> >   {
> >     int result = 1;  
> 
> Same here, change the type of variable "result".
> 
> (...)
> > diff --git a/gcc/fortran/dependency.cc b/gcc/fortran/dependency.cc
> > index a648d5c7903..b398b29a642 100644
> > --- a/gcc/fortran/dependency.cc
> > +++ b/gcc/fortran/dependency.cc  
> (...)
> 
> > @@ -1091,7 +1091,7 @@ gfc_check_argument_dependency (gfc_expr *other, sym_intent intent,
> >   /* Like gfc_check_argument_dependency, but check all the arguments in ACTUAL.
> >      FNSYM is the function being called, or NULL if not known.  */
> >   
> > -int
> > +bool
> >   gfc_check_fncall_dependency (gfc_expr *other, sym_intent intent,
> >   			     gfc_symbol *fnsym, gfc_actual_arglist *actual,
> >   			     gfc_dep_check elemental)  
> 
> Why not change the associated subfunctions 
> (gfc_check_argument_dependency, gfc_check_argument_var_dependency) as well ?

I have left these subfunctions alone for now to get the other hunks out
of the way. I have adjusted the patch according to your other comments
and pushed it as r14-973-gc072df1ab14450.

Thanks!

> 
> (...)
> > @@ -2098,7 +2098,7 @@ ref_same_as_full_array (gfc_ref *full_ref, gfc_ref *ref)
> >   	    there is some kind of overlap.
> >   	0 : array references are identical or not overlapping.  */
> >   
> > -int
> > +bool
> >   gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse,
> >   		  bool identical)
> >   {  
> 
> The function comment states that the function may return 2, which 
> doesn't seem to be the case any more.  So please update the comment.
> 
> (...)> diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc
> > index 221165d6dac..b4b36e27d75 100644
> > --- a/gcc/fortran/symbol.cc
> > +++ b/gcc/fortran/symbol.cc
> > @@ -3216,7 +3216,7 @@ gfc_find_symtree_in_proc (const char* name, gfc_namespace* ns)
> >      any parent namespaces if requested by a nonzero parent_flag.
> >      Returns nonzero if the name is ambiguous.  */
> >   
> > -int
> > +bool
> >   gfc_find_sym_tree (const char *name, gfc_namespace *ns, int parent_flag,
> >   		   gfc_symtree **result)
> >   {  
> 
> Maybe change nonzero to true in the comment?
> 
> (...)
> 
> OK with all the above fixed.
> 
> Thanks.
>
  

Patch

diff --git a/gcc/fortran/array.cc b/gcc/fortran/array.cc
index be5eb8b6a0f..4b7c1e715bf 100644
--- a/gcc/fortran/array.cc
+++ b/gcc/fortran/array.cc
@@ -994,7 +994,7 @@  compare_bounds (gfc_expr *bound1, gfc_expr *bound2)
 /* Compares two array specifications.  They must be constant or deferred
    shape.  */
 
-int
+bool
 gfc_compare_array_spec (gfc_array_spec *as1, gfc_array_spec *as2)
 {
   int i;
@@ -1039,7 +1039,7 @@  gfc_compare_array_spec (gfc_array_spec *as1, gfc_array_spec *as2)
    use the symbol as an implied-DO iterator.  Returns nonzero if a
    duplicate was found.  */
 
-static int
+static bool
 check_duplicate_iterator (gfc_constructor_base base, gfc_symbol *master)
 {
   gfc_constructor *c;
@@ -1982,7 +1982,7 @@  is_constant_element (gfc_expr *e)
    i=1,100000000) /) will take a while as* opposed to a more clever
    function that traverses the expression tree. FIXME.  */
 
-int
+bool
 gfc_constant_ac (gfc_expr *e)
 {
   expand_info expand_save;
@@ -2005,7 +2005,7 @@  gfc_constant_ac (gfc_expr *e)
 /* Returns nonzero if an array constructor has been completely
    expanded (no iterators) and zero if iterators are present.  */
 
-int
+bool
 gfc_expanded_ac (gfc_expr *e)
 {
   gfc_constructor *c;
diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc
index b348bda6e6c..4e3aed84b9d 100644
--- a/gcc/fortran/check.cc
+++ b/gcc/fortran/check.cc
@@ -1156,7 +1156,7 @@  dim_rank_check (gfc_expr *dim, gfc_expr *array, int allow_assumed)
    dimension bi, returning 0 if they are known not to be identical,
    and 1 if they are identical, or if this cannot be determined.  */
 
-static int
+static bool
 identical_dimen_shape (gfc_expr *a, int ai, gfc_expr *b, int bi)
 {
   mpz_t a_size, b_size;
diff --git a/gcc/fortran/cpp.cc b/gcc/fortran/cpp.cc
index c3b7c7f7bd9..d7890a97287 100644
--- a/gcc/fortran/cpp.cc
+++ b/gcc/fortran/cpp.cc
@@ -297,7 +297,7 @@  gfc_cpp_init_options (unsigned int decoded_options_count,
   gfc_cpp_option.deferred_opt_count = 0;
 }
 
-int
+bool
 gfc_cpp_handle_option (size_t scode, const char *arg, int value ATTRIBUTE_UNUSED)
 {
   int result = 1;
@@ -749,7 +749,6 @@  gfc_cpp_add_include_path_after (char *path, bool user_supplied)
 
 static void scan_translation_unit_trad (cpp_reader *);
 static void account_for_newlines (const unsigned char *, size_t);
-static int dump_macro (cpp_reader *, cpp_hashnode *, void *);
 
 static void print_line (location_t, const char *);
 static void maybe_print_line (location_t);
diff --git a/gcc/fortran/cpp.h b/gcc/fortran/cpp.h
index 886996f2784..d2fbfcf9525 100644
--- a/gcc/fortran/cpp.h
+++ b/gcc/fortran/cpp.h
@@ -39,7 +39,7 @@  void gfc_cpp_init (void);
 void gfc_cpp_init_options (unsigned int decoded_options_count,
 			   struct cl_decoded_option *decoded_options);
 
-int gfc_cpp_handle_option(size_t scode, const char *arg, int value);
+bool gfc_cpp_handle_option(size_t scode, const char *arg, int value);
 
 void gfc_cpp_post_options (bool);
 
diff --git a/gcc/fortran/dependency.cc b/gcc/fortran/dependency.cc
index a648d5c7903..b398b29a642 100644
--- a/gcc/fortran/dependency.cc
+++ b/gcc/fortran/dependency.cc
@@ -921,7 +921,7 @@  gfc_ref_needs_temporary_p (gfc_ref *ref)
 }
 
 
-static int
+static bool
 gfc_is_data_pointer (gfc_expr *e)
 {
   gfc_ref *ref;
@@ -1091,7 +1091,7 @@  gfc_check_argument_dependency (gfc_expr *other, sym_intent intent,
 /* Like gfc_check_argument_dependency, but check all the arguments in ACTUAL.
    FNSYM is the function being called, or NULL if not known.  */
 
-int
+bool
 gfc_check_fncall_dependency (gfc_expr *other, sym_intent intent,
 			     gfc_symbol *fnsym, gfc_actual_arglist *actual,
 			     gfc_dep_check elemental)
@@ -1137,7 +1137,7 @@  gfc_check_fncall_dependency (gfc_expr *other, sym_intent intent,
    e1->ref and e2->ref to determine whether the actually accessed
    portions of these variables/arrays potentially overlap.  */
 
-int
+bool
 gfc_are_equivalenced_arrays (gfc_expr *e1, gfc_expr *e2)
 {
   gfc_equiv_list *l;
@@ -2098,7 +2098,7 @@  ref_same_as_full_array (gfc_ref *full_ref, gfc_ref *ref)
 	    there is some kind of overlap.
 	0 : array references are identical or not overlapping.  */
 
-int
+bool
 gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse,
 		  bool identical)
 {
diff --git a/gcc/fortran/dependency.h b/gcc/fortran/dependency.h
index b1150316f5d..fbbede8b22c 100644
--- a/gcc/fortran/dependency.h
+++ b/gcc/fortran/dependency.h
@@ -32,13 +32,13 @@  enum gfc_dep_check
 bool gfc_ref_needs_temporary_p (gfc_ref *);
 bool gfc_full_array_ref_p (gfc_ref *, bool *);
 gfc_expr *gfc_get_noncopying_intrinsic_argument (gfc_expr *);
-int gfc_check_fncall_dependency (gfc_expr *, sym_intent, gfc_symbol *,
+bool gfc_check_fncall_dependency (gfc_expr *, sym_intent, gfc_symbol *,
 				 gfc_actual_arglist *, gfc_dep_check);
 int gfc_check_dependency (gfc_expr *, gfc_expr *, bool);
 int gfc_expr_is_one (gfc_expr *, int);
 
-int gfc_dep_resolver (gfc_ref *, gfc_ref *, gfc_reverse *,
+bool gfc_dep_resolver (gfc_ref *, gfc_ref *, gfc_reverse *,
 		      bool identical = false);
-int gfc_are_equivalenced_arrays (gfc_expr *, gfc_expr *);
+bool gfc_are_equivalenced_arrays (gfc_expr *, gfc_expr *);
 
 gfc_expr * gfc_discard_nops (gfc_expr *);
diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index d91722e6ac6..aa01a4d3d22 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -798,7 +798,7 @@  gfc_copy_ref (gfc_ref *src)
 
 /* Detect whether an expression has any vector index array references.  */
 
-int
+bool
 gfc_has_vector_index (gfc_expr *e)
 {
   gfc_ref *ref;
@@ -888,7 +888,7 @@  gfc_kind_max (gfc_expr *e1, gfc_expr *e2)
 
 /* Returns nonzero if the type is numeric, zero otherwise.  */
 
-static int
+static bool
 numeric_type (bt type)
 {
   return type == BT_COMPLEX || type == BT_REAL || type == BT_INTEGER;
@@ -897,7 +897,7 @@  numeric_type (bt type)
 
 /* Returns nonzero if the typespec is a numeric type, zero otherwise.  */
 
-int
+bool
 gfc_numeric_ts (gfc_typespec *ts)
 {
   return numeric_type (ts->type);
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index ac21e1813d9..9dd6b45f112 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -3220,16 +3220,16 @@  void gfc_release_include_path (void);
 void gfc_check_include_dirs (bool);
 FILE *gfc_open_included_file (const char *, bool, bool);
 
-int gfc_at_end (void);
-int gfc_at_eof (void);
-int gfc_at_bol (void);
-int gfc_at_eol (void);
+bool gfc_at_end (void);
+bool gfc_at_eof (void);
+bool gfc_at_bol (void);
+bool gfc_at_eol (void);
 void gfc_advance_line (void);
-int gfc_define_undef_line (void);
+bool gfc_define_undef_line (void);
 
-int gfc_wide_is_printable (gfc_char_t);
-int gfc_wide_is_digit (gfc_char_t);
-int gfc_wide_fits_in_byte (gfc_char_t);
+bool gfc_wide_is_printable (gfc_char_t);
+bool gfc_wide_is_digit (gfc_char_t);
+bool gfc_wide_fits_in_byte (gfc_char_t);
 gfc_char_t gfc_wide_tolower (gfc_char_t);
 gfc_char_t gfc_wide_toupper (gfc_char_t);
 size_t gfc_wide_strlen (const gfc_char_t *);
@@ -3487,7 +3487,7 @@  void gfc_release_symbol (gfc_symbol *&);
 gfc_symbol *gfc_new_symbol (const char *, gfc_namespace *);
 gfc_symtree* gfc_find_symtree_in_proc (const char *, gfc_namespace *);
 int gfc_find_symbol (const char *, gfc_namespace *, int, gfc_symbol **);
-int gfc_find_sym_tree (const char *, gfc_namespace *, int, gfc_symtree **);
+bool gfc_find_sym_tree (const char *, gfc_namespace *, int, gfc_symtree **);
 int gfc_get_symbol (const char *, gfc_namespace *, gfc_symbol **);
 bool gfc_verify_c_interop (gfc_typespec *);
 bool gfc_verify_c_interop_param (gfc_symbol *);
@@ -3567,10 +3567,10 @@  bool gfc_convert_type (gfc_expr *, gfc_typespec *, int);
 bool gfc_convert_type_warn (gfc_expr *, gfc_typespec *, int, int,
 			    bool array = false);
 bool gfc_convert_chartype (gfc_expr *, gfc_typespec *);
-int gfc_generic_intrinsic (const char *);
-int gfc_specific_intrinsic (const char *);
+bool gfc_generic_intrinsic (const char *);
+bool gfc_specific_intrinsic (const char *);
 bool gfc_is_intrinsic (gfc_symbol*, int, locus);
-int gfc_intrinsic_actual_ok (const char *, const bool);
+bool gfc_intrinsic_actual_ok (const char *, const bool);
 gfc_intrinsic_sym *gfc_find_function (const char *);
 gfc_intrinsic_sym *gfc_find_subroutine (const char *);
 gfc_intrinsic_sym *gfc_intrinsic_function_by_id (gfc_isym_id);
@@ -3648,7 +3648,7 @@  void gfc_type_convert_binary (gfc_expr *, int);
 bool gfc_is_constant_expr (gfc_expr *);
 bool gfc_simplify_expr (gfc_expr *, int);
 bool gfc_try_simplify_expr (gfc_expr *, int);
-int gfc_has_vector_index (gfc_expr *);
+bool gfc_has_vector_index (gfc_expr *);
 
 gfc_expr *gfc_get_expr (void);
 gfc_expr *gfc_get_array_expr (bt type, int kind, locus *);
@@ -3672,7 +3672,7 @@  gfc_ref* gfc_copy_ref (gfc_ref*);
 
 bool gfc_specification_expr (gfc_expr *);
 
-int gfc_numeric_ts (gfc_typespec *);
+bool gfc_numeric_ts (gfc_typespec *);
 int gfc_kind_max (gfc_expr *, gfc_expr *);
 
 bool gfc_check_conformance (gfc_expr *, gfc_expr *, const char *, ...) ATTRIBUTE_PRINTF_3;
@@ -3737,11 +3737,11 @@  void gfc_resolve (gfc_namespace *);
 void gfc_resolve_code (gfc_code *, gfc_namespace *);
 void gfc_resolve_blocks (gfc_code *, gfc_namespace *);
 void gfc_resolve_formal_arglist (gfc_symbol *);
-int gfc_impure_variable (gfc_symbol *);
-int gfc_pure (gfc_symbol *);
-int gfc_implicit_pure (gfc_symbol *);
+bool gfc_impure_variable (gfc_symbol *);
+bool gfc_pure (gfc_symbol *);
+bool gfc_implicit_pure (gfc_symbol *);
 void gfc_unset_implicit_pure (gfc_symbol *);
-int gfc_elemental (gfc_symbol *);
+bool gfc_elemental (gfc_symbol *);
 bool gfc_resolve_iterator (gfc_iterator *, bool, bool);
 bool find_forall_index (gfc_expr *, gfc_symbol *, int);
 bool gfc_resolve_index (gfc_expr *, int);
@@ -3755,8 +3755,8 @@  bool gfc_resolve_intrinsic (gfc_symbol *, locus *);
 bool gfc_explicit_interface_required (gfc_symbol *, char *, int);
 extern int gfc_do_concurrent_flag;
 const char* gfc_lookup_function_fuzzy (const char *, gfc_symtree *);
-int gfc_pure_function (gfc_expr *e, const char **name);
-int gfc_implicit_pure_function (gfc_expr *e);
+bool gfc_pure_function (gfc_expr *e, const char **name);
+bool gfc_implicit_pure_function (gfc_expr *e);
 
 
 /* array.cc */
@@ -3769,12 +3769,12 @@  bool gfc_set_array_spec (gfc_symbol *, gfc_array_spec *, locus *);
 gfc_array_spec *gfc_copy_array_spec (gfc_array_spec *);
 bool gfc_resolve_array_spec (gfc_array_spec *, int);
 
-int gfc_compare_array_spec (gfc_array_spec *, gfc_array_spec *);
+bool gfc_compare_array_spec (gfc_array_spec *, gfc_array_spec *);
 
 void gfc_simplify_iterator_var (gfc_expr *);
 bool gfc_expand_constructor (gfc_expr *, bool);
-int gfc_constant_ac (gfc_expr *);
-int gfc_expanded_ac (gfc_expr *);
+bool gfc_constant_ac (gfc_expr *);
+bool gfc_expanded_ac (gfc_expr *);
 bool gfc_resolve_character_array_constructor (gfc_expr *);
 bool gfc_resolve_array_constructor (gfc_expr *);
 bool gfc_check_constructor_type (gfc_expr *);
@@ -3859,7 +3859,7 @@  symbol_attribute gfc_expr_attr (gfc_expr *);
 symbol_attribute gfc_caf_attr (gfc_expr *, bool i = false, bool *r = NULL);
 match gfc_match_rvalue (gfc_expr **);
 match gfc_match_varspec (gfc_expr*, int, bool, bool);
-int gfc_check_digit (char, int);
+bool gfc_check_digit (char, int);
 bool gfc_is_function_return_value (gfc_symbol *, gfc_namespace *);
 bool gfc_convert_to_structure_constructor (gfc_expr *, gfc_symbol *,
 					      gfc_expr **,
diff --git a/gcc/fortran/intrinsic.cc b/gcc/fortran/intrinsic.cc
index b5ef664eb33..74970e567fc 100644
--- a/gcc/fortran/intrinsic.cc
+++ b/gcc/fortran/intrinsic.cc
@@ -1107,7 +1107,7 @@  gfc_find_subroutine (const char *name)
 /* Given a string, figure out if it is the name of a generic intrinsic
    function or not.  */
 
-int
+bool
 gfc_generic_intrinsic (const char *name)
 {
   gfc_intrinsic_sym *sym;
@@ -1120,7 +1120,7 @@  gfc_generic_intrinsic (const char *name)
 /* Given a string, figure out if it is the name of a specific
    intrinsic function or not.  */
 
-int
+bool
 gfc_specific_intrinsic (const char *name)
 {
   gfc_intrinsic_sym *sym;
@@ -1132,7 +1132,7 @@  gfc_specific_intrinsic (const char *name)
 
 /* Given a string, figure out if it is the name of an intrinsic function
    or subroutine allowed as an actual argument or not.  */
-int
+bool
 gfc_intrinsic_actual_ok (const char *name, const bool subroutine_flag)
 {
   gfc_intrinsic_sym *sym;
diff --git a/gcc/fortran/io.cc b/gcc/fortran/io.cc
index 594f609cbf7..f0c605ebd80 100644
--- a/gcc/fortran/io.cc
+++ b/gcc/fortran/io.cc
@@ -2010,15 +2010,6 @@  gfc_free_open (gfc_open *open)
   free (open);
 }
 
-
-static int
-compare_to_allowed_values (const char *specifier, const char *allowed[],
-			   const char *allowed_f2003[],
-			   const char *allowed_gnu[], gfc_char_t *value,
-			   const char *statement, bool warn, locus *where,
-			   int *num = NULL);
-
-
 static bool
 check_open_constraints (gfc_open *open, locus *where);
 
@@ -2062,12 +2053,12 @@  gfc_resolve_open (gfc_open *open, locus *where)
    value if it is not allowed.  */
 
 
-static int
+static bool
 compare_to_allowed_values (const char *specifier, const char *allowed[],
 			   const char *allowed_f2003[],
 			   const char *allowed_gnu[], gfc_char_t *value,
 			   const char *statement, bool warn, locus *where,
-			   int *num)
+			   int *num = NULL)
 {
   int i;
   unsigned int len;
diff --git a/gcc/fortran/parse.cc b/gcc/fortran/parse.cc
index f1e55316e5b..5e2a95688d2 100644
--- a/gcc/fortran/parse.cc
+++ b/gcc/fortran/parse.cc
@@ -4710,7 +4710,7 @@  done:
    context that causes it to become redefined.  If the symbol is an
    iterator, we generate an error message and return nonzero.  */
 
-int
+bool
 gfc_check_do_variable (gfc_symtree *st)
 {
   gfc_state_data *s;
diff --git a/gcc/fortran/parse.h b/gcc/fortran/parse.h
index 75aac8bb2a1..cc57e7d5729 100644
--- a/gcc/fortran/parse.h
+++ b/gcc/fortran/parse.h
@@ -63,7 +63,7 @@  extern gfc_state_data *gfc_state_stack;
 #define gfc_comp_struct(s) \
   ((s) == COMP_DERIVED || (s) == COMP_STRUCTURE || (s) == COMP_MAP)
 
-int gfc_check_do_variable (gfc_symtree *);
+bool gfc_check_do_variable (gfc_symtree *);
 bool gfc_find_state (gfc_compile_state);
 gfc_state_data *gfc_enclosing_unit (gfc_compile_state *);
 const char *gfc_ascii_statement (gfc_statement, bool strip_sentinel = false) ;
diff --git a/gcc/fortran/primary.cc b/gcc/fortran/primary.cc
index 077489ab96e..3099f82850c 100644
--- a/gcc/fortran/primary.cc
+++ b/gcc/fortran/primary.cc
@@ -109,10 +109,10 @@  get_kind (int *is_iso_c)
 /* Given a character and a radix, see if the character is a valid
    digit in that radix.  */
 
-int
+bool
 gfc_check_digit (char c, int radix)
 {
-  int r;
+  bool r;
 
   switch (radix)
     {
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 58f05a3e74a..9c92958a397 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -1585,7 +1585,7 @@  resolve_structure_cons (gfc_expr *expr, int init)
 /* Returns 0 if a symbol was not declared with a type or
    attribute declaration statement, nonzero otherwise.  */
 
-static int
+static bool
 was_declared (gfc_symbol *sym)
 {
   symbol_attribute a;
@@ -3091,13 +3091,13 @@  is_external_proc (gfc_symbol *sym)
 /* Figure out if a function reference is pure or not.  Also set the name
    of the function for a potential error message.  Return nonzero if the
    function is PURE, zero if not.  */
-static int
+static bool
 pure_stmt_function (gfc_expr *, gfc_symbol *);
 
-int
+bool
 gfc_pure_function (gfc_expr *e, const char **name)
 {
-  int pure;
+  bool pure;
   gfc_component *comp;
 
   *name = NULL;
@@ -3137,7 +3137,7 @@  gfc_pure_function (gfc_expr *e, const char **name)
 
 /* Check if the expression is a reference to an implicitly pure function.  */
 
-int
+bool
 gfc_implicit_pure_function (gfc_expr *e)
 {
   gfc_component *comp = gfc_get_proc_ptr_comp (e);
@@ -3168,7 +3168,7 @@  impure_stmt_fcn (gfc_expr *e, gfc_symbol *sym,
 }
 
 
-static int
+static bool
 pure_stmt_function (gfc_expr *e, gfc_symbol *sym)
 {
   return gfc_traverse_expr (e, sym, impure_stmt_fcn, 0) ? 0 : 1;
@@ -7630,7 +7630,7 @@  resolve_forall_iterators (gfc_forall_iterator *it)
    PRIVATE.  The search is recursive if necessary.  Returns zero if no
    inaccessible components are found, nonzero otherwise.  */
 
-static int
+static bool
 derived_inaccessible (gfc_symbol *sym)
 {
   gfc_component *c;
@@ -17126,7 +17126,7 @@  resolve_data (gfc_data *d)
 /* Determines if a variable is not 'pure', i.e., not assignable within a pure
    procedure.  Returns zero if assignment is OK, nonzero if there is a
    problem.  */
-int
+bool
 gfc_impure_variable (gfc_symbol *sym)
 {
   gfc_symbol *proc;
@@ -17161,7 +17161,7 @@  gfc_impure_variable (gfc_symbol *sym)
 /* Test whether a symbol is pure or not.  For a NULL pointer, checks if the
    current namespace is inside a pure procedure.  */
 
-int
+bool
 gfc_pure (gfc_symbol *sym)
 {
   symbol_attribute attr;
@@ -17193,7 +17193,7 @@  gfc_pure (gfc_symbol *sym)
    checks if the current namespace is implicitly pure.  Note that this
    function returns false for a PURE procedure.  */
 
-int
+bool
 gfc_implicit_pure (gfc_symbol *sym)
 {
   gfc_namespace *ns;
@@ -17247,7 +17247,7 @@  gfc_unset_implicit_pure (gfc_symbol *sym)
 
 /* Test whether the current procedure is elemental or not.  */
 
-int
+bool
 gfc_elemental (gfc_symbol *sym)
 {
   symbol_attribute attr;
diff --git a/gcc/fortran/scanner.cc b/gcc/fortran/scanner.cc
index 4f45da44607..9f0d9a7dc5e 100644
--- a/gcc/fortran/scanner.cc
+++ b/gcc/fortran/scanner.cc
@@ -56,7 +56,7 @@  gfc_directorylist *include_dirs, *intrinsic_modules_dirs;
 
 static gfc_file *file_head, *current_file;
 
-static int continue_flag, end_flag, gcc_attribute_flag;
+static bool continue_flag, end_flag, gcc_attribute_flag;
 /* If !$omp/!$acc occurred in current comment line.  */
 static int openmp_flag, openacc_flag;
 static int continue_count, continue_line;
@@ -86,7 +86,7 @@  static gfc_char_t *last_error_char;
 /* Functions dealing with our wide characters (gfc_char_t) and
    sequences of such characters.  */
 
-int
+bool
 gfc_wide_fits_in_byte (gfc_char_t c)
 {
   return (c <= UCHAR_MAX);
@@ -98,7 +98,7 @@  wide_is_ascii (gfc_char_t c)
   return (gfc_wide_fits_in_byte (c) && ((unsigned char) c & ~0x7f) == 0);
 }
 
-int
+bool
 gfc_wide_is_printable (gfc_char_t c)
 {
   return (gfc_wide_fits_in_byte (c) && ISPRINT ((unsigned char) c));
@@ -116,7 +116,7 @@  gfc_wide_toupper (gfc_char_t c)
   return (wide_is_ascii (c) ? (gfc_char_t) TOUPPER((unsigned char) c) : c);
 }
 
-int
+bool
 gfc_wide_is_digit (gfc_char_t c)
 {
   return (c >= '0' && c <= '9');
@@ -518,7 +518,7 @@  gfc_open_included_file (const char *name, bool include_cwd, bool module)
 
 /* Test to see if we're at the end of the main source file.  */
 
-int
+bool
 gfc_at_end (void)
 {
   return end_flag;
@@ -527,7 +527,7 @@  gfc_at_end (void)
 
 /* Test to see if we're at the end of the current file.  */
 
-int
+bool
 gfc_at_eof (void)
 {
   if (gfc_at_end ())
@@ -545,7 +545,7 @@  gfc_at_eof (void)
 
 /* Test to see if we're at the beginning of a new line.  */
 
-int
+bool
 gfc_at_bol (void)
 {
   if (gfc_at_eof ())
@@ -557,7 +557,7 @@  gfc_at_bol (void)
 
 /* Test to see if we're at the end of a line.  */
 
-int
+bool
 gfc_at_eol (void)
 {
   if (gfc_at_eof ())
@@ -702,7 +702,7 @@  skip_comment_line (void)
 }
 
 
-int
+bool
 gfc_define_undef_line (void)
 {
   char *tmp;
@@ -1803,7 +1803,7 @@  gfc_gobble_whitespace (void)
 	 easily report line and column numbers consistent with other 
 	 parts of gfortran.  */
 
-static int
+static bool
 load_line (FILE *input, gfc_char_t **pbuf, int *pbuflen, const int *first_char)
 {
   int c, maxlen, i, preprocessor_flag, buflen = *pbuflen;
diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc
index 221165d6dac..b4b36e27d75 100644
--- a/gcc/fortran/symbol.cc
+++ b/gcc/fortran/symbol.cc
@@ -3216,7 +3216,7 @@  gfc_find_symtree_in_proc (const char* name, gfc_namespace* ns)
    any parent namespaces if requested by a nonzero parent_flag.
    Returns nonzero if the name is ambiguous.  */
 
-int
+bool
 gfc_find_sym_tree (const char *name, gfc_namespace *ns, int parent_flag,
 		   gfc_symtree **result)
 {
diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 785cf504816..9f8aa09673a 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -4982,7 +4982,7 @@  done:
 /* Return true if both symbols could refer to the same data object.  Does
    not take account of aliasing due to equivalence statements.  */
 
-static int
+static bool
 symbols_could_alias (gfc_symbol *lsym, gfc_symbol *rsym, bool lsym_pointer,
 		     bool lsym_target, bool rsym_pointer, bool rsym_target)
 {
diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc
index 18e2b8b78b4..cd32542eb86 100644
--- a/gcc/fortran/trans-decl.cc
+++ b/gcc/fortran/trans-decl.cc
@@ -483,7 +483,7 @@  gfc_set_decl_assembler_name (tree decl, tree name)
 
 /* Returns true if a variable of specified size should go on the stack.  */
 
-int
+bool
 gfc_can_put_var_on_stack (tree size)
 {
   unsigned HOST_WIDE_INT low;
diff --git a/gcc/fortran/trans-types.cc b/gcc/fortran/trans-types.cc
index fc5c221a301..d718f28cc86 100644
--- a/gcc/fortran/trans-types.cc
+++ b/gcc/fortran/trans-types.cc
@@ -1374,7 +1374,7 @@  gfc_get_element_type (tree type)
 
 /* Returns true if the array sym does not require a descriptor.  */
 
-int
+bool
 gfc_is_nodesc_array (gfc_symbol * sym)
 {
   symbol_attribute *array_attr;
@@ -2451,7 +2451,7 @@  gfc_add_field_to_struct (tree context, tree name, tree type, tree **chain)
    the two derived type symbols are "equal", as described
    in 4.4.2 and resolved by gfc_compare_derived_types.  */
 
-int
+bool
 gfc_copy_dt_decls_ifequal (gfc_symbol *from, gfc_symbol *to,
 			   bool from_gsym)
 {
@@ -2940,7 +2940,7 @@  copy_derived_types:
 }
 
 
-int
+bool
 gfc_return_by_reference (gfc_symbol * sym)
 {
   if (!sym->attr.function)
diff --git a/gcc/fortran/trans-types.h b/gcc/fortran/trans-types.h
index 2dc692325cf..d5746ca4366 100644
--- a/gcc/fortran/trans-types.h
+++ b/gcc/fortran/trans-types.h
@@ -88,7 +88,7 @@  tree gfc_get_character_type_len_for_eltype (tree, tree);
 tree gfc_sym_type (gfc_symbol *, bool is_bind_c_arg = false);
 tree gfc_get_cfi_type (int dimen, bool restricted);
 tree gfc_typenode_for_spec (gfc_typespec *, int c = 0);
-int gfc_copy_dt_decls_ifequal (gfc_symbol *, gfc_symbol *, bool);
+bool gfc_copy_dt_decls_ifequal (gfc_symbol *, gfc_symbol *, bool);
 
 tree gfc_get_function_type (gfc_symbol *, gfc_actual_arglist *args = NULL,
 			    const char *fnspec = NULL);
@@ -109,10 +109,10 @@  tree gfc_add_field_to_struct (tree, tree, tree, tree **);
 void gfc_finish_type (tree);
 
 /* Some functions have an extra parameter for the return value.  */
-int gfc_return_by_reference (gfc_symbol *);
+bool gfc_return_by_reference (gfc_symbol *);
 
 /* Returns true if the array sym does not require a descriptor.  */
-int gfc_is_nodesc_array (gfc_symbol *);
+bool gfc_is_nodesc_array (gfc_symbol *);
 
 /* Return the DTYPE for an array.  */
 tree gfc_get_dtype_rank_type (int, tree);
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index 1ad6d944fcf..0c8d004736d 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -670,7 +670,7 @@  void gfc_restore_sym (gfc_symbol *, gfc_saved_var *);
 void gfc_set_decl_assembler_name (tree, tree);
 
 /* Returns true if a variable of specified size should go on the stack.  */
-int gfc_can_put_var_on_stack (tree);
+bool gfc_can_put_var_on_stack (tree);
 
 /* Set GFC_DECL_SCALAR_* on decl from sym if needed.  */
 void gfc_finish_decl_attrs (tree, symbol_attribute *);