===================================================================
@@ -11777,22 +11777,23 @@ convert_vector_to_pointer_for_subscript
tree type = TREE_TYPE (*vecp);
tree type1;
if (TREE_CODE (index) == INTEGER_CST)
if (!tree_fits_uhwi_p (index)
|| tree_to_uhwi (index) >= TYPE_VECTOR_SUBPARTS (type))
warning_at (loc, OPT_Warray_bounds, "index value is out of bound");
c_common_mark_addressable_vec (*vecp);
type = build_qualified_type (TREE_TYPE (type), TYPE_QUALS (type));
- type = build_pointer_type (type);
type1 = build_pointer_type (TREE_TYPE (*vecp));
+ type = build_pointer_type_for_mode (type, ptr_mode,
+ TYPE_REF_CAN_ALIAS_ALL (type1));
*vecp = build1 (ADDR_EXPR, type1, *vecp);
*vecp = convert (type, *vecp);
}
}
/* Determine which of the operands, if any, is a scalar that needs to be
converted to a vector, for the range of operations. */
enum stv_conv
scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1,
bool complain)
===================================================================
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -w -Wno-abi" } */
+
+typedef int v2si __attribute__ ((vector_size (8)));
+typedef short v4hi __attribute__ ((vector_size (8), may_alias));
+
+__attribute__ ((noinline, noclone))
+int f (v2si A, int N)
+{ return ((v4hi)A)[N]; }
+
+int main(){
+ v2si x = { 0, 0 };
+ if (f (x, 0) || f (x, 1) || f (x, 2) || f (x, 3))
+ __builtin_abort ();
+ return 0;
+}