diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-03-08 09:35:20 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-03-08 09:35:20 +0100 |
commit | 4b48e88382ab6c37aa981881adac0390a74eaeaa (patch) | |
tree | 1684a0b26430d0e91a14dc71ed9c8ca1af76db4e /gcc/internal-fn.c | |
parent | e90223fe94aee2d3a357f64fcf96f12e10750c03 (diff) | |
download | gcc-4b48e88382ab6c37aa981881adac0390a74eaeaa.zip gcc-4b48e88382ab6c37aa981881adac0390a74eaeaa.tar.gz gcc-4b48e88382ab6c37aa981881adac0390a74eaeaa.tar.bz2 |
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
Diffstat (limited to 'gcc/internal-fn.c')
-rw-r--r-- | gcc/internal-fn.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c index ffe291d..df7b930 100644 --- a/gcc/internal-fn.c +++ b/gcc/internal-fn.c @@ -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); |