Message ID | f1212d26-dda4-a0e1-e0ae-95b89e3ce61b@gmx.ch |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 33CC53858014 for <patchwork@sourceware.org>; Tue, 2 Nov 2021 12:58:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 33CC53858014 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635857881; bh=mxvZL/ZwtzgrC2esN7XoF95BGsNKMf6uGyH0i7JQ0gg=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=HYho4rdGITuFA/o1+MlpoFipU9PzIREytjSa9nnZALu0h8gYnYwxj6uKRuxzFgic7 gyJEDv+/Gl93S6VBCYzeFKhEjRTaQuY7u81OyITZWwIHwOle+e7bF2dorYn2uzwo+A mAEN5c+S2LYOzFrBPHjc2J/untRqd9L1xeV6hzR4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by sourceware.org (Postfix) with ESMTPS id 95BF43858D35; Tue, 2 Nov 2021 12:57:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 95BF43858D35 X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.99.12] ([212.126.164.126]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mwfai-1mXdrp2lXm-00y993; Tue, 02 Nov 2021 13:57:11 +0100 To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] PR fortran/91497 -- Silence conversion warnings for MIN1 and MAX1 Message-ID: <f1212d26-dda4-a0e1-e0ae-95b89e3ce61b@gmx.ch> Date: Tue, 2 Nov 2021 13:57:11 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------DA38E3A88DD4C28B1A8F2770" Content-Language: en-US X-Provags-ID: V03:K1:5c3jsBgp/f/JJply4OOyqc10XT12OotZpS7Z2rm5UAlG4VC/v0d BUwLkjqQqTUY5ApEZ6qSano/DtPDmgnbxceF5pfQLRKtvsLoPMDsCgnxi6254DXpAAGpso3 AmuMWngqXBvXeusDrJMGsqd85HMtju3NyIwAEgaML4Ml7SX8HxZTXHeuRNrhEta/0WIH4nq dHHNK81rqKK++tgP2B8lg== X-UI-Out-Filterresults: notjunk:1;V03:K0:3HWksONdf/Q=:zYms5qKQ9cf328AhdpqWDR M2u6u1848rChu5IFdWou1yFBV2IVWWBwcFkMAcfHF48Qvuy4+kLqElciAIjef1h6ATOwShi1V wqKWx8tBCmsHpGOslwfIfa7HEyZ1Uu9UEG/YRFwUqhmCxfXxZjr30ez5jSnMXbD4sYYxf03mE KWZ6I4UaAiIOWcPqqa6wBZVqo5SauMYrhW8mWdifnxVZZ3j2sv4EIuQBFqTS8C8ApGA8+g/kn wqCJopFkQIjRKisKvyhCdsQDshr4Y+UQvB1bWhzjAI17ZXuVS5jTKDlqB7On6SurGJW8Yh1Io y8M8s942aE7YbxV/C3kP2feIjpTCrTf+l9y5N1INeA2qkB2y7483GCRl/6C0xHCwWtpPmETWB /5BeZ8EQEL7XA6UcxlXiJsx9Uze6HAB4ekmbSDV0tmhboI46v11bp1OtnIm1loi5/X4CoP+fv dqCwKAfAK9ipWYS6fVUfA2qXh1tc1CvZZMuFacRw7HuR+sLva6QIjbKGReWUt/e5nVXf/RYbz l5HtMrCAL1QM6FHV1r341UOBLaL1r6MpW6HJXx4squEj3jJ5n0oagUovWni7YCnNq3+WPaU/8 PovAqpiRv8a9iKbwKP0CU6ZXWq5wzRsadbvI3hVsR0eNiuJR/H1i0EZ806JcHpWomR/nsz0+8 UTZLIiS4pJWutnkHgBEw72Isg2dmTllPog8WvYObZwL4suFSAjC/HY8aSPMgUKJoOb4wDwwHM wMjaQYz6A1hdRp38j3RqmDC2moGwoAYRArjvMUHtyn1JBWt6fdY7IiJTdoimQm9HM+BEJ5IMs ZZ2J+8wTVf8f8mnaQ2s+q7PFD75EHPuPDoHXIi+0b/nWfoso26uiiUkjeeB/tYjrWM9bFTay4 JODor19fib71YqdXLVyNX3+9ENd+0ghw1eUmLgQLEJw8P5qs1t/FbJlkpqHfdSiDqSdYNH01k eBD8rADzR/OtCoZ5T9hM3WuX968TZSqUQ9Q4f/hZLVo6w4u6WjEtlNO+k5zpuoWpTIPK+5qPr LJW8NtzYh0O8oA2AM7U+KeCjVqhIG+PoCww5kf85CJ1AuOJXqnJsF+8Xuefb+hahvit1MFS0u NZit3tIeJ+4wuU= X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Manfred Schwarb via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Manfred Schwarb <manfred99@gmx.ch> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
PR fortran/91497 -- Silence conversion warnings for MIN1 and MAX1
|
|
Commit Message
Manfred Schwarb
Nov. 2, 2021, 12:57 p.m. UTC
Hi, In addition to the patches of Steve Kargl for PR 91497: The MIN1 and MAX1 intrinsics do explicit type conversions and should be silenced too for -Wconversion and -Wconversion-extra. Adjust testcase to only use *4 and *8 real types, provide a second testcase for *10 and *16 precisions. Regtested on Linux x86_64. Signed-off-by Manfred Schwarb <manfred99@gmx.ch>
Comments
Hi Manfred, > In addition to the patches of Steve Kargl for PR 91497: > The MIN1 and MAX1 intrinsics do explicit type conversions and should > be silenced too for -Wconversion and -Wconversion-extra. > > Adjust testcase to only use *4 and *8 real types, provide a second > testcase for *10 and *16 precisions. Two points: We should modify existing test cases only when necessary, because modification can impede a regression test. It is better to create a new one. While we do recognize real*4 and real*8 and so on, these are non-standard extensions, and I would like to avoid to have these with new test cases. Instead of real*8, you can use real(8) or double precision. OK with these changes to the test cases. Thanks for the patch! Best regards Thomas
Am 02.11.21 um 14:26 schrieb Thomas Koenig: > Hi Manfred, > >> In addition to the patches of Steve Kargl for PR 91497: >> The MIN1 and MAX1 intrinsics do explicit type conversions and should >> be silenced too for -Wconversion and -Wconversion-extra. >> >> Adjust testcase to only use *4 and *8 real types, provide a second >> testcase for *10 and *16 precisions. > Two points: > > We should modify existing test cases only when necessary, because > modification can impede a regression test. It is better to create > a new one. > Yes, but this was a quick-and-dirty test of mine, and I realized only afterwards that Steve had used it as-is. The new testcase is more consistent and more complete. Sandra got errors on targets without REAL(16) support and requested changes, so I decided to split it. So you want me to "split" it in 3 parts? - existing test as is, only for targets with REAL(16) support - additional tests incl. complex intrinsics for targets with REAL(16) support - additional tests incl. complex intrinsics for all targets, only single and double precision OTOH, it is perhaps not worth the trouble to do REAL(10) and REAL(16) tests, either it warns or it does not. > While we do recognize real*4 and real*8 and so on, these are > non-standard extensions, and I would like to avoid to have these > with new test cases. > > Instead of real*8, you can use real(8) or double precision. > Well, double precision is deprecated AFAIK. > OK with these changes to the test cases. > > Thanks for the patch! > > Best regards > > Thomas
On 02.11.21 15:22, Manfred Schwarb wrote: > Am 02.11.21 um 14:26 schrieb Thomas Koenig: >> Hi Manfred, >> >>> In addition to the patches of Steve Kargl for PR 91497: >>> The MIN1 and MAX1 intrinsics do explicit type conversions and should >>> be silenced too for -Wconversion and -Wconversion-extra. >>> >>> Adjust testcase to only use *4 and *8 real types, provide a second >>> testcase for *10 and *16 precisions. >> Two points: >> >> We should modify existing test cases only when necessary, because >> modification can impede a regression test. It is better to create >> a new one. >> > > Yes, but this was a quick-and-dirty test of mine, and I realized only afterwards > that Steve had used it as-is. The new testcase is more consistent and more complete. > Sandra got errors on targets without REAL(16) support and requested changes, > so I decided to split it. > > So you want me to "split" it in 3 parts? > - existing test as is, only for targets with REAL(16) support > - additional tests incl. complex intrinsics for targets with REAL(16) support > - additional tests incl. complex intrinsics for all targets, only single and double precision > > OTOH, it is perhaps not worth the trouble to do REAL(10) and REAL(16) tests, either > it warns or it does not. Anything that tests both complex and REAL(16) is fine by me. I don't think you need to test the combination of COMPLEX(16), both codepaths have been seen by that time :-) Or you can split it three ways, like you wrote above. >> While we do recognize real*4 and real*8 and so on, these are >> non-standard extensions, and I would like to avoid to have these >> with new test cases. >> >> Instead of real*8, you can use real(8) or double precision. >> > > Well, double precision is deprecated AFAIK. Not in Fortran 2018. Best regards Thomas
Am 02.11.21 um 19:39 schrieb Thomas Koenig: > On 02.11.21 15:22, Manfred Schwarb wrote: >> Am 02.11.21 um 14:26 schrieb Thomas Koenig: >>> Hi Manfred, >>> >>>> In addition to the patches of Steve Kargl for PR 91497: >>>> The MIN1 and MAX1 intrinsics do explicit type conversions and should >>>> be silenced too for -Wconversion and -Wconversion-extra. >>>> >>>> Adjust testcase to only use *4 and *8 real types, provide a second >>>> testcase for *10 and *16 precisions. >>> Two points: >>> >>> We should modify existing test cases only when necessary, because >>> modification can impede a regression test. It is better to create >>> a new one. >>> I only changed the test case to use dg-require-effective-target and real(n) notation now. Added a second case without real(10) and real(16), but for all targets, which covers MIN1 and MAX1 too. >> >> Yes, but this was a quick-and-dirty test of mine, and I realized only afterwards >> that Steve had used it as-is. The new testcase is more consistent and more complete. >> Sandra got errors on targets without REAL(16) support and requested changes, >> so I decided to split it. >> >> So you want me to "split" it in 3 parts? >> - existing test as is, only for targets with REAL(16) support >> - additional tests incl. complex intrinsics for targets with REAL(16) support >> - additional tests incl. complex intrinsics for all targets, only single and double precision >> >> OTOH, it is perhaps not worth the trouble to do REAL(10) and REAL(16) tests, either >> it warns or it does not. > > Anything that tests both complex and REAL(16) is fine by me. I don't > think you need to test the combination of COMPLEX(16), both > codepaths have been seen by that time :-) > > Or you can split it three ways, like you wrote above. > >>> While we do recognize real*4 and real*8 and so on, these are >>> non-standard extensions, and I would like to avoid to have these >>> with new test cases. >>> >>> Instead of real*8, you can use real(8) or double precision. >>> >> >> Well, double precision is deprecated AFAIK. > > Not in Fortran 2018. > > Best regards > > Thomas >
Hi Manfred, looks good to me. Thanks for the patch! Best regards Thomas
2021-11-02 Manfred Schwarb <manfred99@gmx.ch> gcc/fortran/ChangeLog: PR fortran/91497 * simplify.c (simplify_min_max): Disable conversion warnings for MIN1 and MAX1. --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -5087,6 +5087,7 @@ min_max_choose (gfc_expr *arg, gfc_expr static gfc_expr * simplify_min_max (gfc_expr *expr, int sign) { + int tmp1, tmp2; gfc_actual_arglist *arg, *last, *extremum; gfc_expr *tmp, *ret; const char *fname; @@ -5131,7 +5132,16 @@ simplify_min_max (gfc_expr *expr, int si if ((tmp->ts.type != BT_INTEGER || tmp->ts.kind != gfc_integer_4_kind) && (strcmp (fname, "min1") == 0 || strcmp (fname, "max1") == 0)) { + /* Explicit conversion, turn off -Wconversion and -Wconversion-extra + warnings. */ + tmp1 = warn_conversion; + tmp2 = warn_conversion_extra; + warn_conversion = warn_conversion_extra = 0; + ret = gfc_convert_constant (tmp, BT_INTEGER, gfc_integer_4_kind); + + warn_conversion = tmp1; + warn_conversion_extra = tmp2; } else if ((tmp->ts.type != BT_REAL || tmp->ts.kind != gfc_real_4_kind) && (strcmp (fname, "amin0") == 0 || strcmp (fname, "amax0") == 0))