public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Eric Botcazou <ebotcazou@adacore.com>
Subject: [COMMITTED] ada: Fix wrong code for ACATS cd1c03i on Morello target
Date: Thu, 15 Jun 2023 10:04:36 +0200	[thread overview]
Message-ID: <20230615080436.940392-1-poulhies@adacore.com> (raw)

From: Eric Botcazou <ebotcazou@adacore.com>

gcc/ada/

	* gcc-interface/utils2.cc (build_binary_op) <MODIFY_EXPR>: Do not
	remove a VIEW_CONVERT_EXPR on the LHS if it is also on the RHS.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/gcc-interface/utils2.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc
index e1737724b65..95bbce2f1b4 100644
--- a/gcc/ada/gcc-interface/utils2.cc
+++ b/gcc/ada/gcc-interface/utils2.cc
@@ -878,7 +878,8 @@ build_binary_op (enum tree_code op_code, tree result_type,
 	 them; we'll be putting them back below if needed.  Likewise for
 	 conversions between record types, except for justified modular types.
 	 But don't do this if the right operand is not BLKmode (for packed
-	 arrays) unless we are not changing the mode.  */
+	 arrays) unless we are not changing the mode, or if both ooperands
+	 are view conversions to the same type.  */
       while ((CONVERT_EXPR_P (left_operand)
 	      || TREE_CODE (left_operand) == VIEW_CONVERT_EXPR)
 	     && (((INTEGRAL_TYPE_P (left_type)
@@ -890,7 +891,10 @@ build_binary_op (enum tree_code op_code, tree result_type,
 		     && TREE_CODE (operand_type (left_operand)) == RECORD_TYPE
 		     && (TYPE_MODE (right_type) == BLKmode
 			 || TYPE_MODE (left_type)
-			    == TYPE_MODE (operand_type (left_operand))))))
+			    == TYPE_MODE (operand_type (left_operand)))
+		     && !(TREE_CODE (left_operand) == VIEW_CONVERT_EXPR
+			  && TREE_CODE (right_operand) == VIEW_CONVERT_EXPR
+			  && left_type == right_type))))
 	{
 	  left_operand = TREE_OPERAND (left_operand, 0);
 	  left_type = TREE_TYPE (left_operand);
-- 
2.40.0


                 reply	other threads:[~2023-06-15  8:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230615080436.940392-1-poulhies@adacore.com \
    --to=poulhies@adacore.com \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).