From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by sourceware.org (Postfix) with ESMTPS id 358963858D37; Sun, 13 Aug 2023 21:16:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 358963858D37 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=1691961395; x=1692566195; i=anlauf@gmx.de; bh=VifXvlIG5BFUhjUH/D4MQSme9nEvSJWYEEH8fgLhlFs=; h=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To; b=Dn9oetenfEbRvSXNhjdRzwYS1BF4h4EL12Sc09Y+yHX0lv+BCNeyzgtENRRkWyF+AeeuddT FJjO40sHIU6OEcOHgwlUyGtE7WQt1vsCrEBw9FIEuvksAPMAs/Q7tQV7g/fSTDvLZ7wsK7VF4 H+41OWtTTde13kKR/QSiGoW2mG0r1U8nntv85FX48t70SLSELHszkK0phEXjPsDV8gR6VpKRL 8omVlkM/3Es4EZtt1Y3fsyUs33oNylOa74BsmN+PdGgyP7lW/uThABba9j7XhmCKOHiy3ZoCr /TNDcLH4ghxaLsgclls8nCCDbtkAPaKrPyowSy41htpPGuuYyGcA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.178.29] ([79.251.6.29]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MTABZ-1qLdYC2uJ5-00UcG3; Sun, 13 Aug 2023 23:16:35 +0200 Message-ID: <69ae66ca-df06-4169-88cb-96290d28aeac@gmx.de> Date: Sun, 13 Aug 2023 23:16:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/3] fortran: fix length one character dummy args [PR110419] To: Mikael Morin , fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Newsgroups: gmane.comp.gcc.patches,gmane.comp.gcc.fortran References: <20230809202122.695376-1-mikael@gcc.gnu.org> Content-Language: en-US From: Harald Anlauf In-Reply-To: <20230809202122.695376-1-mikael@gcc.gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:pXzEmoPwoDuwpDcoZlRLCzkKb+vsrT3Ay1qdgPdzeosCA7I9qAl wtiJGSeRLLUKBXK2WII/qbvf6tRK+VwZHj/MraugMhiSgYjG7ARjvyTtivHhpxyE1O6J3Ut bOKKmOFT+m3qroHHrYYzzE62bO/d7ABHonx23LPVW9yEiDzizrVhTJ9v7a/2gVPLCppAHLH IqBYCTdzdsaVaXeIUGWPg== UI-OutboundReport: notjunk:1;M01:P0:A9V+xDnY+u4=;SI9dN9pLe81PIVYbyI3nVAtLr4s jyg9ELGoIH5Wq/igQDmTtGpr2NPjAk3doQItD6xux3jT6b4gp4faFMsdViQOesyZCobcdxEtj ny0W0bcDE6KWHltDKANCtdWXk3r0fHrnfVGI0eEgRSek6X6WxjT1v7PaspyimNUUxBrVfDJD+ 7zBEryatIebKDDa0kfI/PFRzwyM3uSD00zmv8BLvDBmfg/IfM2QaQFAxu/x4TyObBnlP1IS39 jqwkXXsh9d2qe2P9mlVjiLT7Wil+Bem0PO25oGEabfCApOJQe27nDZ9LzVAasW2PFosFJp8FA BQIQ3wBuRhHsYdKEgQgoFfcret1T96Fcut75kpw4TZHD7KoZaICpNl1+pcLnf/WIbhZn83MpZ hRsDN0l6nToG5fqaeFhW9RtrMpp3A64nXArb2x9tuXNU+CI0LHsaDz9iPulJDQcTOH/yAWJbs 3keJjkYHCA/Rze48nsYsUpEK+9aJlz8t56naL6tTxKciDXgpy6W9Hw1IREFfuGoqQPlvf5QfH a6aDe4t2p4n5I8RJvCOWRhjukPoPx/XrcSuBX4s71odQL2mKctJH+6wYxLMPr7AbAuilMV1Y6 /ddjbuZfzl0eSBfEkTNUcS3rmrBb8abg5qduyB9NwcB3Z7YcpposkJgwuHVzOiJD1/UZYpRQJ M3gxc2oUvEuvNbYLWB/F9DRKRD+0Yv/68DoCXNx4jrw+BWWXm1kC0pXyCR2rgNO3XcXSmdDtg lNKokZthv5qS4colANxp0yBoWqcvnEWpJOerLGl1P8J8jl8crfu2iSSlehvUFvxXgjnn7NVzm sKFpJW2pR76txLo2m5FO2zI6ekaXsIS3bE+WZU16jIyqVAbN8BgCQaU2PBY7uXd6UKZo/wXjw QDahwxeyKoQ3RJO3GZ5iZ1LzHJz5lb42ia264dqvjXujfXVjrHblpKZ7bk0K5MGhlVBGWmZMb kkGdEGHfpkr4x+hlJWoF9SpuYbY= X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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: Hi Mikael, Am 09.08.23 um 22:21 schrieb Mikael Morin via Gcc-patches: > Hello, > > I propose with this patchset a fix for the test value_9.f90 which has be= en > failing on 32 bits powerpc since it was added a few weeks back (see PR11= 0360 > and PR110419). > > The problem is an argument type mismatch between a procedure declaration= , > and the argument value for a call of that same procedure, in the specifi= c > case of length one character dummy arguments with the value attribute. > Admittedly, our argument passing conventions [1] for those are currently > unspecified. > > Before PR110360, character dummy arguments with value attribute were > arrays passed by value, but the actual argument was still passed as > reference. PR110360 changed that to pass length one dummies as bare > character (i.e. scalar integer), like in the bind(c) case (but with leng= th > argument still present). However, the argument type in the function dec= laration > wasn't changed at the same time, so the test was failing on big-endian 3= 2 bits > targets. Surprisingly, on most targets the middle-end, back-end and run= time > are happy to get a scalar value passed where a length one array is expec= ted. > > This can be fixed, either by reverting back to arguments represented as > arrays passed by value with calls fixed, or by keeping the new > representation with single characters for arguments and fixing the proce= dure > types accordingly. > > I haven't really tried the first way, this is using the second one. > The first patch is a preliminary refactoring. The main change is the > second patch. It modifies the types of length one character dummy argsu= ments > with value attribute in the procedure declarations, so that they are sca= lar > integer types, consistently with how arguments are passed for calls. > The third patch is a change of error codes in the testcase. > > I have regression tested this on x86_64-unknown-linux-gnu, and > powerpc64-unknown-linux-gnu (both -m32 and -m64). > OK for master? this looks good to me. There was only one thing I was uncertain what the right way is: you chose to use mpz_cmp_ui in the length check in the new helper function gfc_length_one_character_type_p, while in many other places the length check uses mpz_cmp_si. Admittedly, a negative (effective/declared) character length can never occur, except maybe at intermediate times during resolution before this is fixed up in accordance with the standard. So this is probably more a cosmetic decision, and you can decide to use either variant. Thanks for the patch! Harald > [1] https://gcc.gnu.org/onlinedocs/gfortran/Argument-passing-conventions= .html > > > Mikael Morin (3): > fortran: New predicate gfc_length_one_character_type_p > fortran: Fix length one character dummy arg type [PR110419] > testsuite: Use distinct explicit error codes in value_9.f90 > > gcc/fortran/check.cc | 7 +- > gcc/fortran/decl.cc | 4 +- > gcc/fortran/gfortran.h | 15 +++ > gcc/fortran/trans-expr.cc | 39 ++++--- > gcc/fortran/trans-types.cc | 5 +- > gcc/testsuite/gfortran.dg/bind_c_usage_13.f03 | 8 +- > gcc/testsuite/gfortran.dg/value_9.f90 | 108 +++++++++--------- > 7 files changed, 103 insertions(+), 83 deletions(-) >