re PR target/79904 (ICE in annotate_constant_pool_refs, at config/s390/s390.c:7909)

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.

	* gcc.dg/ubsan/pr79904.c: New test.

From-SVN: r245967
This commit is contained in:
Jakub Jelinek 2017-03-08 09:35:20 +01:00 committed by Jakub Jelinek
parent e90223fe94
commit 4b48e88382
4 changed files with 37 additions and 6 deletions

View File

@ -1,3 +1,10 @@
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

View File

@ -1869,12 +1869,20 @@ expand_vector_ubsan_overflow (location_t loc, enum tree_code code, tree lhs,
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);

View File

@ -1,3 +1,8 @@
2017-03-08 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/79904
* gcc.dg/ubsan/pr79904.c: New test.
2017-03-07 Jakub Jelinek <jakub@redhat.com>
PR c/79834

View File

@ -0,0 +1,11 @@
/* PR sanitizer/79904 */
/* { dg-do compile } */
/* { dg-options "-fsanitize=signed-integer-overflow -Wno-psabi" } */
typedef signed char V __attribute__((vector_size (8)));
void
foo (V *a)
{
*a = *a * 3;
}