From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.smtpout.orange.fr (smtp-25.smtpout.orange.fr [80.12.242.25]) by sourceware.org (Postfix) with ESMTPS id 049083858D35 for ; Sun, 14 May 2023 12:27:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 049083858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=orange.fr Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=orange.fr Received: from [192.168.1.16] ([86.215.161.51]) by smtp.orange.fr with ESMTPA id yApDpBaP1hGQdyApIpVxtc; Sun, 14 May 2023 14:27:48 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.fr; s=t20230301; t=1684067268; bh=BsqQZHNZzZqWMZeEIatM2WN/n8nctAECQEiPCSPR4Fk=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=mt/TnI/iBGG+GkjCqG5efTy9shZUMwHkD155plFNrC0j3CQSRsSU22t/KAg6OBaPa L4q5YCxeD/oZkVtPusKNPXlT8cXRIHL7nTsw4EhfOE+Zy5U/vWmZosl6Km+ugLa7Rw pnBoev+t8R747JL3hkBGmx3zZWIUW8rJaNoxIsFfDWdGLxAYsss5yG4O2XQ0q/NHV+ vdhIT21geXIy+89UZa5U18kGomxb3Aigr/pEl6Ei2G6dgVF2WFDVVd4w6f2S/Y52WH I+bB53ApjQ/2z3knGGl/9N2bGXvyX+Wu1fJefK+Wn7cp/+O5n7TtpeCVfpG/FYl3mQ vv7Gx/oHyDdGg== X-ME-Helo: [192.168.1.16] X-ME-Auth: bW9yaW4tbWlrYWVsQG9yYW5nZS5mcg== X-ME-Date: Sun, 14 May 2023 14:27:48 +0200 X-ME-IP: 86.215.161.51 Message-ID: Date: Sun, 14 May 2023 14:27:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v2] Fortran: Narrow return types [PR78798] To: Bernhard Reutner-Fischer , fortran@gcc.gnu.org Cc: gcc-patches@gcc.gnu.org, Bernhard Reutner-Fischer References: <8B220543-5633-47CA-8DF9-0381613CBDF3@gmail.com> <20230510164719.155783-1-rep.dot.nop@gmail.com> Content-Language: fr From: Mikael Morin In-Reply-To: <20230510164719.155783-1-rep.dot.nop@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,JMQ_SPF_NEUTRAL,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE,URIBL_SBL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Le 10/05/2023 à 18:47, Bernhard Reutner-Fischer via Fortran a écrit : > From: Bernhard Reutner-Fischer > > 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.