summaryrefslogtreecommitdiff
path: root/gcc/tree-data-ref.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-10 07:40:37 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-10 07:40:37 +0000
commit69a837167a2ec4f5c8f7d92c1713561e69a1c6b2 (patch)
tree97187c171008938f7d60d88651e0c06b1c5c10ab /gcc/tree-data-ref.c
parent1c8dc67208d018473a11e596f686e729285199b8 (diff)
downloadgcc-69a837167a2ec4f5c8f7d92c1713561e69a1c6b2.tar.gz
PR tree-optimization/33680
* tree-data-ref.c (split_constant_offset) <case ADDR_EXPR>: Punt if the added cast involves variable length types. * gcc.c-torture/compile/20071108-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130067 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-data-ref.c')
-rw-r--r--gcc/tree-data-ref.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index bf7d2ab6aea..8d9c4c98a55 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -560,7 +560,27 @@ split_constant_offset (tree exp, tree *var, tree *off)
fold_convert (TREE_TYPE (base), poffset));
}
- *var = fold_convert (type, base);
+ var0 = fold_convert (type, base);
+
+ /* If variable length types are involved, punt, otherwise casts
+ might be converted into ARRAY_REFs in gimplify_conversion.
+ To compute that ARRAY_REF's element size TYPE_SIZE_UNIT, which
+ possibly no longer appears in current GIMPLE, might resurface.
+ This perhaps could run
+ if (TREE_CODE (var0) == NOP_EXPR
+ || TREE_CODE (var0) == CONVERT_EXPR)
+ {
+ gimplify_conversion (&var0);
+ // Attempt to fill in any within var0 found ARRAY_REF's
+ // element size from corresponding op embedded ARRAY_REF,
+ // if unsuccessful, just punt.
+ } */
+ while (POINTER_TYPE_P (type))
+ type = TREE_TYPE (type);
+ if (int_size_in_bytes (type) < 0)
+ break;
+
+ *var = var0;
*off = off0;
return;
}