public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mikael Morin <mikael@gcc.gnu.org>
To: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org
Cc: Richard Biener <rguenther@suse.de>
Subject: [PATCH 3/4] fortran: Generate an array temporary reference [PR102043]
Date: Sat, 16 Apr 2022 18:56:17 +0200	[thread overview]
Message-ID: <20220416165618.236666-4-mikael@gcc.gnu.org> (raw)
In-Reply-To: <20220416165618.236666-1-mikael@gcc.gnu.org>

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


  parent reply	other threads:[~2022-04-16 16:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-16 16:56 [PATCH 0/4] Use pointer arithmetic for array references [PR102043] Mikael Morin
2022-04-16 16:56 ` [PATCH 1/4] fortran: Pre-evaluate string pointers. [PR102043] Mikael Morin
2022-04-16 16:56 ` [PATCH 2/4] fortran: Update index extraction code. [PR102043] Mikael Morin
2022-04-16 16:56 ` Mikael Morin [this message]
2022-04-16 16:56 ` [PATCH 4/4] fortran: Use pointer arithmetic to index arrays [PR102043] Mikael Morin
2022-04-19 15:05 ` [PATCH 0/4] Use pointer arithmetic for array references [PR102043] Richard Biener
2022-04-22 11:09 ` *PING* " Mikael Morin
2022-04-22 13:59   ` Thomas Koenig
2022-04-24  1:57     ` Jerry D
2022-04-26 14:40     ` Hans-Peter Nilsson
2022-04-27  5:48       ` Thomas Koenig
2022-05-02  7:16       ` Stefan Schulze Frielinghaus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220416165618.236666-4-mikael@gcc.gnu.org \
    --to=mikael@gcc.gnu.org \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).