aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-forwprop.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2019-11-29 09:18:48 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2019-11-29 09:18:48 +0000
commit438d9c4afa635c7a1475feebbc220fe8d335c664 (patch)
treeb64ff536de838c4039de3c593cb9221c80eb74f3 /gcc/tree-ssa-forwprop.c
parent52702016ad1b45888ddd37e95e3eb093181fd4d3 (diff)
downloadgcc-438d9c4afa635c7a1475feebbc220fe8d335c664.zip
gcc-438d9c4afa635c7a1475feebbc220fe8d335c664.tar.gz
gcc-438d9c4afa635c7a1475feebbc220fe8d335c664.tar.bz2
re PR tree-optimization/92715 (error: position plus size exceeds size of referenced object in ‘bit_field_ref’)
2019-11-29 Richard Biener <rguenther@suse.de> PR tree-optimization/92715 * tree-ssa-forwprop.c (simplify_vector_constructor): Bail out for uniform vectors and source vectors with less elements than the destination. * gcc.dg/torture/pr92715.c: New testcase. From-SVN: r278833
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r--gcc/tree-ssa-forwprop.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index b275a63..36e6267 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -2038,13 +2038,13 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi)
constructor_elt *elt;
bool maybe_ident;
- gcc_checking_assert (gimple_assign_rhs_code (stmt) == CONSTRUCTOR);
-
op = gimple_assign_rhs1 (stmt);
type = TREE_TYPE (op);
- gcc_checking_assert (TREE_CODE (type) == VECTOR_TYPE);
+ gcc_checking_assert (TREE_CODE (op) == CONSTRUCTOR
+ && TREE_CODE (type) == VECTOR_TYPE);
- if (!TYPE_VECTOR_SUBPARTS (type).is_constant (&nelts))
+ if (!TYPE_VECTOR_SUBPARTS (type).is_constant (&nelts)
+ || uniform_vector_p (op))
return false;
elem_type = TREE_TYPE (type);
elem_size = TREE_INT_CST_LOW (TYPE_SIZE (elem_type));
@@ -2136,6 +2136,9 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi)
|| ! VECTOR_TYPE_P (TREE_TYPE (orig[0])))
return false;
refnelts = TYPE_VECTOR_SUBPARTS (TREE_TYPE (orig[0])).to_constant ();
+ /* We currently do not handle larger destination vectors. */
+ if (refnelts < nelts)
+ return false;
if (maybe_ident)
{