summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4>2008-06-13 10:27:29 +0000
committerhainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4>2008-06-13 10:27:29 +0000
commit77b4865cd75fec6f590d93b3ae051aefc57dafb6 (patch)
treed01b599fca90dca4cb0bf3a3297a7c9801b0c277
parentb2f0b2a33f40ea27f6f1f130f0e20a3aa44eb02c (diff)
downloadgcc-77b4865cd75fec6f590d93b3ae051aefc57dafb6.tar.gz
2008-06-13 Olivier Hainque <hainque@adacore.com>
* utils.c (rest_of_record_type_compilation): When computing encodings for the components of a variable size type, early strip conversions on the current position expression to make sure it's shape is visible. Use remove_conversions for this purpose. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@136748 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/ChangeLog8
-rw-r--r--gcc/ada/utils.c10
2 files changed, 13 insertions, 5 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 5b143ae820a..f0eb327e43d 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,11 @@
+2008-06-13 Olivier Hainque <hainque@adacore.com>
+
+ * utils.c (rest_of_record_type_compilation): When computing
+ encodings for the components of a variable size type, early
+ strip conversions on the current position expression to make
+ sure it's shape is visible. Use remove_conversions for this
+ purpose.
+
2008-06-12 Eric Botcazou <ebotcazou@adacore.com>
* decl.c (gnat_to_gnu_entity) <E_Record_Subtype>: In the case of a
diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c
index d9a0e3aa618..f255d37d6ef 100644
--- a/gcc/ada/utils.c
+++ b/gcc/ada/utils.c
@@ -1085,6 +1085,10 @@ rest_of_record_type_compilation (tree record_type)
If this is a union, the position can be taken as zero. */
+ /* Some computations depend on the shape of the position expression,
+ so strip conversions to make sure it's exposed. */
+ curpos = remove_conversions (curpos, true);
+
if (TREE_CODE (new_record_type) == UNION_TYPE)
pos = bitsize_zero_node, align = 0;
else
@@ -1096,13 +1100,9 @@ rest_of_record_type_compilation (tree record_type)
tree offset = TREE_OPERAND (curpos, 0);
align = tree_low_cst (TREE_OPERAND (curpos, 1), 1);
- /* Strip off any conversions. */
- while (TREE_CODE (offset) == NON_LVALUE_EXPR
- || CONVERT_EXPR_P (offset))
- offset = TREE_OPERAND (offset, 0);
-
/* An offset which is a bitwise AND with a negative power of 2
means an alignment corresponding to this power of 2. */
+ offset = remove_conversions (offset, true);
if (TREE_CODE (offset) == BIT_AND_EXPR
&& host_integerp (TREE_OPERAND (offset, 1), 0)
&& tree_int_cst_sgn (TREE_OPERAND (offset, 1)) < 0)