From 7a0a2f40b640f70c985df1cf905f11424e9f68c6 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Tue, 30 Jun 2009 19:20:24 +0000 Subject: [PATCH] * gcc-interface/utils2.c (build_binary_op) : Do not use the type of the left operand if it pads a self-referential type when the right operand is a constructor. * gcc-interface/lang-specs.h: Fix copyright date. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149115 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 8 ++++++++ gcc/ada/gcc-interface/lang-specs.h | 2 +- gcc/ada/gcc-interface/utils2.c | 15 +++++++++------ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 65d3720..a79a583 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,13 @@ 2009-06-30 Eric Botcazou + * gcc-interface/utils2.c (build_binary_op) : Do not use + the type of the left operand if it pads a self-referential type when + the right operand is a constructor. + + * gcc-interface/lang-specs.h: Fix copyright date. + +2009-06-30 Eric Botcazou + * gcc-interface/decl.c: Include tree-inline.h. (annotate_value) : Try to inline the call in the expression. * gcc-interface/utils.c (max_size) : Likewise. diff --git a/gcc/ada/gcc-interface/lang-specs.h b/gcc/ada/gcc-interface/lang-specs.h index 1afba37..e0c1be9 100644 --- a/gcc/ada/gcc-interface/lang-specs.h +++ b/gcc/ada/gcc-interface/lang-specs.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 1992-2008, Free Software Foundation, Inc. * + * Copyright (C) 1992-2009, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c index 8ee9d4d..e60e5a0 100644 --- a/gcc/ada/gcc-interface/utils2.c +++ b/gcc/ada/gcc-interface/utils2.c @@ -707,9 +707,10 @@ build_binary_op (enum tree_code op_code, tree result_type, /* If we are copying between padded objects with compatible types, use the padded view of the objects, this is very likely more efficient. - Likewise for a padded that is assigned a constructor, in order to - avoid putting a VIEW_CONVERT_EXPR on the LHS. But don't do this if - we wouldn't have actually copied anything. */ + Likewise for a padded object that is assigned a constructor, if we + can convert the constructor to the inner type, to avoid putting a + VIEW_CONVERT_EXPR on the LHS. But don't do so if we wouldn't have + actually copied anything. */ else if (TREE_CODE (left_type) == RECORD_TYPE && TYPE_IS_PADDING_P (left_type) && TREE_CONSTANT (TYPE_SIZE (left_type)) @@ -719,9 +720,11 @@ build_binary_op (enum tree_code op_code, tree result_type, && TYPE_IS_PADDING_P (TREE_TYPE (TREE_OPERAND (right_operand, 0))) && gnat_types_compatible_p - (left_type, - TREE_TYPE (TREE_OPERAND (right_operand, 0)))) - || TREE_CODE (right_operand) == CONSTRUCTOR) + (left_type, + TREE_TYPE (TREE_OPERAND (right_operand, 0)))) + || (TREE_CODE (right_operand) == CONSTRUCTOR + && !CONTAINS_PLACEHOLDER_P + (DECL_SIZE (TYPE_FIELDS (left_type))))) && !integer_zerop (TYPE_SIZE (right_type))) operation_type = left_type; -- 2.7.4