gimplify.c (gimple_fold_indirect_ref): Check host_integerp before calling tree_low_cst.
authorRichard Guenther <rguenther@suse.de>
Mon, 11 Apr 2011 15:50:57 +0000 (15:50 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 11 Apr 2011 15:50:57 +0000 (15:50 +0000)
2011-04-11  Richard Guenther  <rguenther@suse.de>

* gimplify.c (gimple_fold_indirect_ref): Check host_integerp
before calling tree_low_cst.

From-SVN: r172263

gcc/ChangeLog
gcc/gimplify.c

index 5363fe3a49d3c4f3cc1258765613dee68e9f7498..ce35db2c85696a9be235b19eaf8f77efcc976893 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-11  Richard Guenther  <rguenther@suse.de>
+
+       * gimplify.c (gimple_fold_indirect_ref): Check host_integerp
+       before calling tree_low_cst.
+
 2011-04-11  Richard Guenther  <rguenther@suse.de>
 
        * stor-layout.c (layout_type): Compute all array index size operations
index 598fe9cfb9786df9b1fd8fa9bfebcfd99b8f5f94..9afd4ff27fe2b0b297a895448b812e681424aa96 100644 (file)
@@ -4079,9 +4079,10 @@ gimple_fold_indirect_ref (tree t)
       /* ((foo*)&vectorfoo)[1] -> BIT_FIELD_REF<vectorfoo,...> */
       if (TREE_CODE (addr) == ADDR_EXPR
          && TREE_CODE (TREE_TYPE (addrtype)) == VECTOR_TYPE
-         && useless_type_conversion_p (type, TREE_TYPE (TREE_TYPE (addrtype))))
+         && useless_type_conversion_p (type, TREE_TYPE (TREE_TYPE (addrtype)))
+         && host_integerp (off, 1))
        {
-          HOST_WIDE_INT offset = tree_low_cst (off, 0);
+          unsigned HOST_WIDE_INT offset = tree_low_cst (off, 1);
           tree part_width = TYPE_SIZE (type);
           unsigned HOST_WIDE_INT part_widthi
             = tree_low_cst (part_width, 0) / BITS_PER_UNIT;