+2017-03-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/79904
+ * internal-fn.c (expand_vector_ubsan_overflow): If arg0 or arg1
+ is a uniform vector, use uniform_vector_p return value instead of
+ building ARRAY_REF on folded VIEW_CONVERT_EXPR to array type.
+
2017-03-07 Marek Polacek <polacek@redhat.com>
PR middle-end/79809
if (cnt > 4)
{
tree atype = build_array_type_nelts (eltype, cnt);
- op0 = fold_build1_loc (loc, VIEW_CONVERT_EXPR, atype, arg0);
- op0 = build4_loc (loc, ARRAY_REF, eltype, op0, cntv,
- NULL_TREE, NULL_TREE);
- op1 = fold_build1_loc (loc, VIEW_CONVERT_EXPR, atype, arg1);
- op1 = build4_loc (loc, ARRAY_REF, eltype, op1, cntv,
- NULL_TREE, NULL_TREE);
+ op0 = uniform_vector_p (arg0);
+ if (op0 == NULL_TREE)
+ {
+ op0 = fold_build1_loc (loc, VIEW_CONVERT_EXPR, atype, arg0);
+ op0 = build4_loc (loc, ARRAY_REF, eltype, op0, cntv,
+ NULL_TREE, NULL_TREE);
+ }
+ op1 = uniform_vector_p (arg1);
+ if (op1 == NULL_TREE)
+ {
+ op1 = fold_build1_loc (loc, VIEW_CONVERT_EXPR, atype, arg1);
+ op1 = build4_loc (loc, ARRAY_REF, eltype, op1, cntv,
+ NULL_TREE, NULL_TREE);
+ }
if (resv)
{
res = fold_build1_loc (loc, VIEW_CONVERT_EXPR, atype, resv);