aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-05-21 01:48:54 +0200
committerMarc Poulhiès <poulhies@adacore.com>2023-06-15 09:59:39 +0200
commitd40e6edcff21f29f5aa2f0eec7bd45ee2b6c2a99 (patch)
tree91b26322d77eab60b1285b321ad7053a050c287d /gcc
parent59a8207f83855d756a6a87fa4b9537899d88f0a2 (diff)
downloadgcc-d40e6edcff21f29f5aa2f0eec7bd45ee2b6c2a99.zip
gcc-d40e6edcff21f29f5aa2f0eec7bd45ee2b6c2a99.tar.gz
gcc-d40e6edcff21f29f5aa2f0eec7bd45ee2b6c2a99.tar.bz2
ada: Fix wrong code for ACATS cd1c03i on Morello target
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/gcc-interface/utils2.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc
index e173772..95bbce2 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);