From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by sourceware.org (Postfix) with ESMTPS id 877183858C54; Wed, 7 Jun 2023 18:38:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 877183858C54 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=1686163090; x=1686767890; i=anlauf@gmx.de; bh=9j8X8YNPbqCVyxJgxjA1FErFvDG8TYh5LENxnG8YxhU=; h=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To; b=mzjJgVk6euqrL3uOq+/DABRcDXUv8sWatMHHKX1LhicBXJV9wPN6a+hwk1201qTIAzAz/4o pLXKe3i2CzIv1DI4TDUXZbMUMXW/2Y7UC6XJ3N3yf3DI+To9MhKb7l1yM6H3MPbCkjeZcPR5b +srB3Y2kwpLshbo0QZ8K85bDjLM3sav5942RPbYv2t0Mz0FaiGSHfDP8Y4BVe7bQ79KU7KlW3 2ocehOen/SymgTBY3qOgrwQI1DSgFhckCxDuWr/rzaPg69HCoiojmJmCt3rqt8xYKArD770SO U9hcmdGeEofzmLMTo7KbqB4m/tZgr2Uq0bekOUaE7dZAcR8hnCAA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.178.29] ([79.232.150.177]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MAONX-1qIogr2oh9-00BtH3; Wed, 07 Jun 2023 20:38:10 +0200 Message-ID: Date: Wed, 7 Jun 2023 20:38:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [Patch, fortran] PR87477 - (associate) - [meta-bug] [F03] issues concerning the ASSOCIATE statement Content-Language: en-US To: Paul Richard Thomas , "fortran@gcc.gnu.org" , gcc-patches Newsgroups: gmane.comp.gcc.patches,gmane.comp.gcc.fortran References: From: Harald Anlauf In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:LEnACUTfg+r2MZLUPe8qkTkcdMwFnT4mqcg8dzGwQVLboeYi9gd JAIpXFlFbcNLX+0gFa/Uva07pG+XBj6CQjzI8bAj2m8jNdpykcdlTcmiVYMzpA31wYWEtyC 7P2kNkx3xHiTOzn+nphr1HZRHfXOkKQxF/o0tUtqKT0uXiOaPb/vQoKdgASRi19fC8j+OHn wXlm/OSMjnWt50jo0bGSw== UI-OutboundReport: notjunk:1;M01:P0:qhuRaKLODyo=;v1cLfF3piC5U8O81OhZYCwQ2HsH ZpIXMabZhyad6ut34hXTA4IQPocs2NHCUhcy5ADgOc0GTfv3z52viCLPLQWaODUFwrh8GKeAy L1vy6fG0Zu2visMEAoLlVWrOrcQeRY2gm/xI0vUwsy5F57vXNgN5gAJt847Z++QVK6nZuEbh6 qFflJ8gaHFcIO9cy1EAnhLpupSvRnsdEI/XC5E8MRq/JBPkmv72MGhGhHnWLz7dBavWLt6okX rse8kTWYb6j4enjymgKiujoKxi41SKB/ntVKj0ztLVnpyyT2f/yEO9tq265f9W8NcPE9qyMXj uTGAcrZsUIC3XdIyxb95JZet0EdFyRM8/wc8t/aOItaj9ApXzl55da7Y0QmcaKz6LL8fnFmhs Racu+JBqHEXLGI6n+ndvGgoUrIPtxLrscnDnMWFiKZJLfU0X1diUWjOSE3Na9f54f6DlFsB0E 4K1663G+va6rvn5f/aofDggGaHWdNn1hKEIGZ7ggcLOFYIfVXFT+gJZqld86G7Uztrvbxj/XG VCKMfpsItd9FXNnbjMGsKa/fViFF2O0BzeN7SL8PiIEP4tqax7gxSUqhprOoJ97x9QBLGyO1P /wO0AZ4ezuOzaUyfXyZOopwMJoHaTbHVDqWaLWi8+4/A8Vc9CUfRygYEPvs0wj7aNRnA2+/A2 YKkSF82NIYelLOKyPTg68bwAVuxb9XUH3ZDXkTAZ9ff2g+dbhtJJMEHXFsb4HwA1Xh+L3Z4NW 2IYZzQhOMjd88y20ah+eBUfzuZYVRrJwMgC5VziFo0PcFPX+O9pyuiO8T1WpoCzNSIjCrh6Se G7ohQXifJRW7KsrQnM5xhM/bmRkB7QKS/6rzCm9dgFlULnJ1p7tZgtb79Su6v5Tl3kHWfx76E rcxuLlG7Tc4bMqMLNYC/y5OS33j6D+q3PDEPuvb60VdAKuZtrPmYX+TQTORM+TCLkAgpINrsr qhucPgM2y0zjjeOwtW7X/kKIVkk= X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: Hi Paul! On 6/7/23 18:10, Paul Richard Thomas via Gcc-patches wrote: > Hi All, > > Three more fixes for PR87477. Please note that PR99350 was a blocker > but, as pointed out in comment #5 of the PR, this has nothing to do > with the associate construct. > > All three fixes are straight forward and the .diff + ChangeLog suffice > to explain them. 'rankguessed' was made redundant by the last PR87477 > fix. > > Regtests on x86_64 - good for mainline? > > Paul > > Fortran: Fix some more blockers in associate meta-bug [PR87477] > > 2023-06-07 Paul Thomas > > gcc/fortran > PR fortran/99350 > * decl.cc (char_len_param_value): Simplify a copy of the expr > and replace the original if there is no error. This seems to lack a gfc_free_expr (p) in case the gfc_replace_expr is not executed, leading to a possible memleak. Can you check? @@ -1081,10 +1082,10 @@ char_len_param_value (gfc_expr **expr, bool *deferred) if (!gfc_expr_check_typed (*expr, gfc_current_ns, false)) return MATCH_ERROR; - /* If gfortran gets an EXPR_OP, try to simplify it. This catches thing= s - like CHARACTER(([1])). */ - if ((*expr)->expr_type =3D=3D EXPR_OP) - gfc_simplify_expr (*expr, 1); + /* Try to simplify the expression to catch things like CHARACTER(([1])). */ + p =3D gfc_copy_expr (*expr); + if (gfc_is_constant_expr (p) && gfc_simplify_expr (p, 1)) + gfc_replace_expr (*expr, p); else gfc_free_expr (p); > * gfortran.h : Remove the redundant field 'rankguessed' from > 'gfc_association_list'. > * resolve.cc (resolve_assoc_var): Remove refs to 'rankguessed'. > > PR fortran/107281 > * resolve.cc (resolve_variable): Associate names with constant > or structure constructor targets cannot have array refs. > > PR fortran/109451 > * trans-array.cc (gfc_conv_expr_descriptor): Guard expression > character length backend decl before using it. Suppress the > assignment if lhs equals rhs. > * trans-io.cc (gfc_trans_transfer): Scalarize transfer of > associate variables pointing to a variable. Add comment. > * trans-stmt.cc (trans_associate_var): Remove requirement that > the character length be deferred before assigning the value > returned by gfc_conv_expr_descriptor. Also, guard the backend > decl before testing with VAR_P. > > gcc/testsuite/ > PR fortran/99350 > * gfortran.dg/pr99350.f90 : New test. > > PR fortran/107281 > * gfortran.dg/associate_5.f03 : Changed error message. > * gfortran.dg/pr107281.f90 : New test. > > PR fortran/109451 > * gfortran.dg/associate_61.f90 : New test Otherwise LGTM. Thanks for the patch! Harald 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 017B03857006 for ; Wed, 7 Jun 2023 18:38:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 017B03857006 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 1q6y2x-0006kT-TJ for gcc-patches@gcc.gnu.org; Wed, 07 Jun 2023 20:38:15 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: gcc-patches@gcc.gnu.org From: Harald Anlauf Subject: Re: [Patch, fortran] PR87477 - (associate) - [meta-bug] [F03] issues concerning the ASSOCIATE statement Date: Wed, 7 Jun 2023 20:38:10 +0200 Message-ID: References: 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.11.0 Content-Language: en-US In-Reply-To: Cc: fortran@gcc.gnu.org X-Spam-Status: No, score=-3.0 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,T_SCC_BODY_TEXT_LINE 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: <20230607183810.r_syhJPdvNTljbKVBQ0b7-q3DVNE2bnKdvnncOeWmZw@z> Hi Paul! On 6/7/23 18:10, Paul Richard Thomas via Gcc-patches wrote: > Hi All, > > Three more fixes for PR87477. Please note that PR99350 was a blocker > but, as pointed out in comment #5 of the PR, this has nothing to do > with the associate construct. > > All three fixes are straight forward and the .diff + ChangeLog suffice > to explain them. 'rankguessed' was made redundant by the last PR87477 > fix. > > Regtests on x86_64 - good for mainline? > > Paul > > Fortran: Fix some more blockers in associate meta-bug [PR87477] > > 2023-06-07 Paul Thomas > > gcc/fortran > PR fortran/99350 > * decl.cc (char_len_param_value): Simplify a copy of the expr > and replace the original if there is no error. This seems to lack a gfc_free_expr (p) in case the gfc_replace_expr is not executed, leading to a possible memleak. Can you check? @@ -1081,10 +1082,10 @@ char_len_param_value (gfc_expr **expr, bool *deferred) if (!gfc_expr_check_typed (*expr, gfc_current_ns, false)) return MATCH_ERROR; - /* If gfortran gets an EXPR_OP, try to simplify it. This catches things - like CHARACTER(([1])). */ - if ((*expr)->expr_type == EXPR_OP) - gfc_simplify_expr (*expr, 1); + /* Try to simplify the expression to catch things like CHARACTER(([1])). */ + p = gfc_copy_expr (*expr); + if (gfc_is_constant_expr (p) && gfc_simplify_expr (p, 1)) + gfc_replace_expr (*expr, p); else gfc_free_expr (p); > * gfortran.h : Remove the redundant field 'rankguessed' from > 'gfc_association_list'. > * resolve.cc (resolve_assoc_var): Remove refs to 'rankguessed'. > > PR fortran/107281 > * resolve.cc (resolve_variable): Associate names with constant > or structure constructor targets cannot have array refs. > > PR fortran/109451 > * trans-array.cc (gfc_conv_expr_descriptor): Guard expression > character length backend decl before using it. Suppress the > assignment if lhs equals rhs. > * trans-io.cc (gfc_trans_transfer): Scalarize transfer of > associate variables pointing to a variable. Add comment. > * trans-stmt.cc (trans_associate_var): Remove requirement that > the character length be deferred before assigning the value > returned by gfc_conv_expr_descriptor. Also, guard the backend > decl before testing with VAR_P. > > gcc/testsuite/ > PR fortran/99350 > * gfortran.dg/pr99350.f90 : New test. > > PR fortran/107281 > * gfortran.dg/associate_5.f03 : Changed error message. > * gfortran.dg/pr107281.f90 : New test. > > PR fortran/109451 > * gfortran.dg/associate_61.f90 : New test Otherwise LGTM. Thanks for the patch! Harald