From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id 8ED9D3858D39; Thu, 18 May 2023 19:52:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8ED9D3858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-96f0678de80so435409266b.3; Thu, 18 May 2023 12:52:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684439545; x=1687031545; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=eO/9A4KuLsYH8SRqgqy0mkxtYACIOhBm71Z5EkkSLWs=; b=WSbkriINXH/gTCNgCINlCB1bH/TEmSK1qdsPzzFvIOnr/UctgKcDURzLOSsHO1OyBb zI/mtKUKFpuAzFhvR1/3Vk7vs9i1F57xZZWhEb7WXK9zRKMeOh9DTdObBOziBpS1+G23 fOvXcIXyJWODaG0idHJqbQ3p5vsunIQcCP59i0lsJI1qUmiQh7+Fjr89K8irk27x+hpL 4q1+RQdFK1sHMACylda+YnpFOG0nzh1AqjpY88WU374fVZLyd2w0KhdbAWb8jJR8IVri 1e4rU3LyqxrBKHcqCLjyfxLVTc1A93TwojxN7MU2EL4eChafwo4bhox6wpjQdHv/mszR URwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684439545; x=1687031545; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eO/9A4KuLsYH8SRqgqy0mkxtYACIOhBm71Z5EkkSLWs=; b=XuVuUUznMwiXB4GLqCfX3p7hL2Z5AcO26Qm2y9uruJkZGi1YihKfQXTl8W+PeC6vQc /mGQHsWmG9D3pJLfmYXk3HqYTIN3R/GZiRpdF/5JXeXvwuV/qCLdkaz0YEpMtcBgeQ6/ cQIhU/C/H4iMsstM29jDl62wYStxrl6eOSaJS0IdgffmVOuO6ckzASdW2FCEu5OXUGcH LH9eu0bl8vHqQnWKBUtxpAZDxxpsDtgbIZMNpty+5RHJ7zv5hlRmhpgwGlsi+WxReaA1 pwAKGXph+BNy7AHgDiBRJCw+GctnuVTMmtTbdI5pbyA8AODPS1msCNG/Nix8mc5RMrV6 xnOg== X-Gm-Message-State: AC+VfDx+SSPwuSZUQmXGB2RF0q1UY0SV/88o0Wi/vVE7hZ6uhwdBGZSV 68NH0RdpquyC765YT+gGL40= X-Google-Smtp-Source: ACHHUZ6VrypfSwmGHIMA8zNYU+v+E7396oi44MpdrqNMgZjNlbEt17RNaDoHW68vtXcnvj++ooy0tg== X-Received: by 2002:a17:907:1624:b0:969:f0bd:5649 with SMTP id hb36-20020a170907162400b00969f0bd5649mr218168ejc.60.1684439544934; Thu, 18 May 2023 12:52:24 -0700 (PDT) Received: from nbbrfq.loc (80-110-214-113.static.upcbusiness.at. [80.110.214.113]) by smtp.gmail.com with ESMTPSA id cd20-20020a170906b35400b0096a5eb2836asm1346078ejb.203.2023.05.18.12.52.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 12:52:24 -0700 (PDT) Date: Thu, 18 May 2023 21:52:20 +0200 From: Bernhard Reutner-Fischer To: Mikael Morin Cc: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org, Bernhard Reutner-Fischer Subject: Re: [PATCH v2] Fortran: Narrow return types [PR78798] Message-ID: <20230518215220.26f4bd3d@nbbrfq.loc> In-Reply-To: References: <8B220543-5633-47CA-8DF9-0381613CBDF3@gmail.com> <20230510164719.155783-1-rep.dot.nop@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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: On Sun, 14 May 2023 14:27:42 +0200 Mikael Morin wrote: > Le 10/05/2023 =C3=A0 18:47, Bernhard Reutner-Fischer via Fortran a =C3=A9= crit=C2=A0: > > From: Bernhard Reutner-Fischer > >=20 > > gcc/fortran/ChangeLog: > >=20 > > PR fortran/78798 > > * array.cc (compare_bounds): Use narrower return type. > > (gfc_compare_array_spec): Likewise. > > (is_constant_element): Likewise. > > (gfc_constant_ac): Likewise. =20 > (...) > > --- > > Bootstrapped without new warnings and regression tested on > > x86_64-linux with no regressions, OK for trunk? > > =20 > (...) > > 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, i= nt 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. */ > > =20 > > -static int > > +static bool > > identical_dimen_shape (gfc_expr *a, int ai, gfc_expr *b, int bi) > > { > > mpz_t a_size, b_size; =20 >=20 > To be consistent, please change as well the local variable "ret" used as= =20 > return value from int to bool. >=20 > > 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 =3D 0; > > } > > =20 > > -int > > +bool > > gfc_cpp_handle_option (size_t scode, const char *arg, int value ATTRI= BUTE_UNUSED) > > { > > int result =3D 1; =20 >=20 > Same here, change the type of variable "result". >=20 > (...) > > 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 =20 > (...) >=20 > > @@ -1091,7 +1091,7 @@ gfc_check_argument_dependency (gfc_expr *other, s= ym_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. */ > > =20 > > -int > > +bool > > gfc_check_fncall_dependency (gfc_expr *other, sym_intent intent, > > gfc_symbol *fnsym, gfc_actual_arglist *actual, > > gfc_dep_check elemental) =20 >=20 > Why not change the associated subfunctions=20 > (gfc_check_argument_dependency, gfc_check_argument_var_dependency)=C2=A0a= s 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! >=20 > (...) > > @@ -2098,7 +2098,7 @@ ref_same_as_full_array (gfc_ref *full_ref, gfc_re= f *ref) > > there is some kind of overlap. > > 0 : array references are identical or not overlapping. */ > > =20 > > -int > > +bool > > gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse, > > bool identical) > > { =20 >=20 > The function comment states that the function may return 2, which=20 > doesn't seem to be the case any more. So please update the comment. >=20 > (...)> 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_n= amespace* ns) > > any parent namespaces if requested by a nonzero parent_flag. > > Returns nonzero if the name is ambiguous. */ > > =20 > > -int > > +bool > > gfc_find_sym_tree (const char *name, gfc_namespace *ns, int parent_fl= ag, > > gfc_symtree **result) > > { =20 >=20 > Maybe change nonzero to true in the comment? >=20 > (...) >=20 > OK with all the above fixed. >=20 > Thanks. >=20