From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.smtpout.orange.fr (smtp05.smtpout.orange.fr [80.12.242.127]) by sourceware.org (Postfix) with ESMTPS id E6738385803E for ; Sat, 16 Apr 2022 16:56:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E6738385803E Received: from cyrano.home ([86.253.179.215]) by smtp.orange.fr with ESMTPA id flicnw6UjFyeGfliin9KxZ; Sat, 16 Apr 2022 18:56:25 +0200 X-ME-Helo: cyrano.home X-ME-Auth: MDU4MTIxYWM4YWI0ZGE4ZTUwZWZmNTExZmI2ZWZlMThkM2ZhYiE5OWRkOGM= X-ME-Date: Sat, 16 Apr 2022 18:56:25 +0200 X-ME-IP: 86.253.179.215 From: Mikael Morin To: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org Cc: Richard Biener Subject: [PATCH 3/4] fortran: Generate an array temporary reference [PR102043] Date: Sat, 16 Apr 2022 18:56:17 +0200 Message-Id: <20220416165618.236666-4-mikael@gcc.gnu.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220416165618.236666-1-mikael@gcc.gnu.org> References: <20220416165618.236666-1-mikael@gcc.gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP, T_SCC_BODY_TEXT_LINE 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: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Apr 2022 16:56:29 -0000 This avoids regressing on char_cast_1.f90 and char_cast_2.f90 later in the patch series when the code generation for array references is changed to use pointer arithmetic. The regressing testcases match part of an array reference in the generated tree dump and it’s not clear how the pattern should be rewritten to match the equivalent with pointer arithmetic. This change uses a method specific to array temporaries to generate array-references, so that these array references are flagged as safe for array indexing and will not be updated to use pointer arithmetic. PR fortran/102043 gcc/fortran/ChangeLog: * trans-array.cc (gfc_conv_expr_descriptor): Use gfc_conv_tmp_array_ref. --- gcc/fortran/trans-array.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index b3f8871ff22..11e47c0c1ca 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -7723,7 +7723,7 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr) lse.ss = loop.temp_ss; rse.ss = ss; - gfc_conv_scalarized_array_ref (&lse, NULL); + gfc_conv_tmp_array_ref (&lse); if (expr->ts.type == BT_CHARACTER) { gfc_conv_expr (&rse, expr); -- 2.35.1