aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-01-26 13:32:27 +0100
committerRichard Biener <rguenther@suse.de>2021-01-26 14:27:04 +0100
commit4b59dbb5d6759e43bfa23161a8d3feb9ae969e1a (patch)
tree1885647ed7b37d416eae98e739afd4cd90fa7f27 /gcc/tree.c
parent2e81b16c24367d7cc92f6d369606dca5575f6b5f (diff)
downloadgcc-4b59dbb5d6759e43bfa23161a8d3feb9ae969e1a.zip
gcc-4b59dbb5d6759e43bfa23161a8d3feb9ae969e1a.tar.gz
gcc-4b59dbb5d6759e43bfa23161a8d3feb9ae969e1a.tar.bz2
middle-end/98726 - fix VECTOR_CST element access
This fixes VECTOR_CST element access with POLY_INT elements and allows to produce dump files of the PR98726 testcase without ICEing. 2021-01-26 Richard Biener <rguenther@suse.de> PR middle-end/98726 * tree.h (vector_cst_int_elt): Remove. * tree.c (vector_cst_int_elt): Use poly_wide_int for computations, make static.
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 287e500..f9d57e6 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -11079,13 +11079,13 @@ build_opaque_vector_type (tree innertype, poly_int64 nunits)
/* Return the value of element I of VECTOR_CST T as a wide_int. */
-wide_int
+static poly_wide_int
vector_cst_int_elt (const_tree t, unsigned int i)
{
/* First handle elements that are directly encoded. */
unsigned int encoded_nelts = vector_cst_encoded_nelts (t);
if (i < encoded_nelts)
- return wi::to_wide (VECTOR_CST_ENCODED_ELT (t, i));
+ return wi::to_poly_wide (VECTOR_CST_ENCODED_ELT (t, i));
/* Identify the pattern that contains element I and work out the index of
the last encoded element for that pattern. */
@@ -11096,13 +11096,13 @@ vector_cst_int_elt (const_tree t, unsigned int i)
/* If there are no steps, the final encoded value is the right one. */
if (!VECTOR_CST_STEPPED_P (t))
- return wi::to_wide (VECTOR_CST_ENCODED_ELT (t, final_i));
+ return wi::to_poly_wide (VECTOR_CST_ENCODED_ELT (t, final_i));
/* Otherwise work out the value from the last two encoded elements. */
tree v1 = VECTOR_CST_ENCODED_ELT (t, final_i - npatterns);
tree v2 = VECTOR_CST_ENCODED_ELT (t, final_i);
- wide_int diff = wi::to_wide (v2) - wi::to_wide (v1);
- return wi::to_wide (v2) + (count - 2) * diff;
+ poly_wide_int diff = wi::to_poly_wide (v2) - wi::to_poly_wide (v1);
+ return wi::to_poly_wide (v2) + (count - 2) * diff;
}
/* Return the value of element I of VECTOR_CST T. */