From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by sourceware.org (Postfix) with ESMTPS id 74FAC38582A1; Sun, 13 Nov 2022 20:29:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 74FAC38582A1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1668371394; bh=yz6Vx0HHqb1W0FYLxCF2wH6yKMTQQ6SQEeGfgmoi37k=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=KOrajmyRvrnT7fAcgCTrw7gro2YYhXbDNqG5rOQ0pudFcbHy/jxzWtHEoIXxBhPzx JeUNo46XTNEj61mE8qFt2PaM9T6ZHUokUFMh7DRM+hfCpg5AvKRuTRrorK3v2EfhAH bG5SgsfXQoghpkdKEpkBjKqTB9Bz8rcvAD6kgaosYDqRNqQ7I/wN8l+0kqNiDjwb7q 67fYlXRo2DSGlSPXC+zgAzerlZthWsHGz5nG+KshO/oZNkQCFevDHPWRZr+ZPh0gMT QD+LgnsOc3qelsnsKOl+SEM/XgxB5KqT2Rqegfgr1oNAZ0PWJPcT8A57QKqP/U5HTR B3G5DFFAsfO4Q== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.178.29] ([93.207.80.48]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MUXtS-1oTsmI0G0W-00QUBE; Sun, 13 Nov 2022 21:29:54 +0100 Message-ID: <638282cb-c299-e022-3296-da1382a0f509@gmx.de> Date: Sun, 13 Nov 2022 21:29:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH 3/5] Fortran: Narrow return types [PR78798] To: Bernhard Reutner-Fischer , Janne Blomqvist Cc: gcc-patches@gcc.gnu.org, Bernhard Reutner-Fischer , fortran@gcc.gnu.org Newsgroups: gmane.comp.gcc.patches,gmane.comp.gcc.fortran References: <20221112234543.95441-1-aldot@gcc.gnu.org> <20221112234543.95441-4-aldot@gcc.gnu.org> <20221113113938.555d4a06@nbbrfq> Content-Language: en-US From: Harald Anlauf In-Reply-To: <20221113113938.555d4a06@nbbrfq> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:USoBe+Cnier/naAvYFUTKEZoGNestShzsAgLi1e8YTtad3O2bAX cZJjGAKmf0hdEjtB9qvLkpVOdVOov8fAsONna+nDZn+BI5Tof+5D7cGpD5JD7hX5fLWucc3 bK1VTe5ZLfVmEmiPUFdLykVsb78mN8CeUXu9nMMnXmi0lW4nTKnPL76GHN9xIEkT0nyGLHD ms7j7JnZgXq1MsQt1r00A== UI-OutboundReport: notjunk:1;M01:P0:EPU1LIgKJt8=;/Rq8PEjoJq8OqezoEfcdeaD+dBE Ih9SyQ+z7wFwwtlliTaYHe782kbyBSYuy/htSL+O+8TEfGD0a6LMsNWbY99E5CkMgyWJxAMgf yg5FsCr24SwDP/+FiDGfbT3FnkbUPnbXhBNr4e50XG3mG3oayK0+pgrTwzXYcHf/av93svTHo t9J3aMvED690sVgNeMEk1UxzA3f3WNqIZyWPSlcF5PIIiKS424GFstpJBtj/Q1vEkbhsvuuoh N+UwEBMGrGOWZG6RABq/Pv8bD1EvEMPu7Dm43W1pENthjX4WqZlJt7jXmZqDcmegUeHycG9K/ Ic2AR3v99uZapq6LlAqwAH7GPHqdMIRAdkScyU64zPHxSBgf64b/ItIBdPLB0OCP9JNOkqcTs 24Tl33QmsfaMzZ6QCk/kDT7Jz4wl+O7gbGFMk83EpaNX3qXXFjwxdsqggXI7ngcbeYOAyRRGA Xe4r8s2+eFoHn4H4gIDw9RnC2AemR3W+1ZpCSBC3qzV2wof3f9FK0vK+0UrYDgiKhtbD42DHr Ki66hbSr34WSx744Ns/4RT9UnL7Az9kC3GzltZL3bhh17LG5x6N8jEobXAV8YJIaxjjXZPsvp 93ZBxKU68+XBbtCdbgRfFzkWZseo6FAyYba7zrGLGgL9NTEC2abc+cVfprwSAnOIXceOhyRZL ddsJ/YWmq5/pLu8UCpOg9f5WUF3klutpMSQKh98863NwCiXryJFEAFxCrnZEdGmBDJs/TLhcf DeYbJA5hpTKq+SnfDoNe6qBzJbQIqXNS6mJR3NhP2nf0qnp079vrUUoQv9GjKnUIvPnyJjn8z R6LRMpCOKm0a1oQOFQnoaDq7VZU1D/GBxsq5Syz3EoM7nwJ6qdekGmxTLmsc10dS5WE4R8aJv iQMV+g99IRDAT+y0M/eOxd6nBbVZd3gOTra5RiOdabaFWU6BoXyGu43pcD3RyRDcsvG405I0j zsq0PiYOT9AtX+hlTWSQRxdjRJ0= X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP 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: Am 13.11.22 um 11:39 schrieb Bernhard Reutner-Fischer via Gcc-patches: > On Sun, 13 Nov 2022 12:13:26 +0200 > Janne Blomqvist wrote: > >> On Sun, Nov 13, 2022 at 1:47 AM Bernhard Reutner-Fischer via Fortran >> wrote: >>> --- a/gcc/fortran/arith.cc >>> +++ b/gcc/fortran/arith.cc >>> @@ -1135,7 +1135,7 @@ compare_complex (gfc_expr *op1, gfc_expr *op2) >>> strings. We return -1 for a < b, 0 for a =3D=3D b and 1 for a > = b. >>> We use the processor's default collating sequence. */ >>> >>> -int >>> +signed char >>> gfc_compare_string (gfc_expr *a, gfc_expr *b) >>> { >>> size_t len, alen, blen, i; >>> @@ -1162,7 +1162,7 @@ gfc_compare_string (gfc_expr *a, gfc_expr *b) >>> } >> >> Hmm, really? PR 78798 mentions changing int to bool, where >> appropriate, which I think is uncontroversial, but this? > > Well we could leave this or all spots alone where a bool is > insufficient, if you prefer. > > In the case of gfc_compare_string, the only user is simplify which only > looks at ge/gt/le/lt 0 My reading of the mentioned PR is that there is a fundamental disagreement with the subject: Bug 78798 - [cleanup] some int-valued functions should be bool I see that as an issue of (a minor lack of) conciseness; it is *not* about narrowing. Replacing "int" by "signed char" adds confusion and makes code less understandable, so I would oppose it, as we don't solve a real problem and rather add confusion. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ciao.gmane.io (ciao.gmane.io [116.202.254.214]) by sourceware.org (Postfix) with ESMTPS id 24157385C301 for ; Sun, 13 Nov 2022 20:29:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 24157385C301 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=m.gmane-mx.org Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1ouJc5-0008PK-GZ for gcc-patches@gcc.gnu.org; Sun, 13 Nov 2022 21:29:57 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: gcc-patches@gcc.gnu.org From: Harald Anlauf Subject: Re: [PATCH 3/5] Fortran: Narrow return types [PR78798] Date: Sun, 13 Nov 2022 21:29:50 +0100 Message-ID: <638282cb-c299-e022-3296-da1382a0f509@gmx.de> References: <20221112234543.95441-1-aldot@gcc.gnu.org> <20221112234543.95441-4-aldot@gcc.gnu.org> <20221113113938.555d4a06@nbbrfq> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Content-Language: en-US In-Reply-To: <20221113113938.555d4a06@nbbrfq> Cc: fortran@gcc.gnu.org X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Message-ID: <20221113202950.qwR9mllSvY6FomG5UsZ4iNb1cdnSRQ5PIdlstEXAJXc@z> Am 13.11.22 um 11:39 schrieb Bernhard Reutner-Fischer via Gcc-patches: > On Sun, 13 Nov 2022 12:13:26 +0200 > Janne Blomqvist wrote: > >> On Sun, Nov 13, 2022 at 1:47 AM Bernhard Reutner-Fischer via Fortran >> wrote: >>> --- a/gcc/fortran/arith.cc >>> +++ b/gcc/fortran/arith.cc >>> @@ -1135,7 +1135,7 @@ compare_complex (gfc_expr *op1, gfc_expr *op2) >>> strings. We return -1 for a < b, 0 for a == b and 1 for a > b. >>> We use the processor's default collating sequence. */ >>> >>> -int >>> +signed char >>> gfc_compare_string (gfc_expr *a, gfc_expr *b) >>> { >>> size_t len, alen, blen, i; >>> @@ -1162,7 +1162,7 @@ gfc_compare_string (gfc_expr *a, gfc_expr *b) >>> } >> >> Hmm, really? PR 78798 mentions changing int to bool, where >> appropriate, which I think is uncontroversial, but this? > > Well we could leave this or all spots alone where a bool is > insufficient, if you prefer. > > In the case of gfc_compare_string, the only user is simplify which only > looks at ge/gt/le/lt 0 My reading of the mentioned PR is that there is a fundamental disagreement with the subject: Bug 78798 - [cleanup] some int-valued functions should be bool I see that as an issue of (a minor lack of) conciseness; it is *not* about narrowing. Replacing "int" by "signed char" adds confusion and makes code less understandable, so I would oppose it, as we don't solve a real problem and rather add confusion.