aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2016-12-13 09:17:42 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2016-12-13 09:17:42 +0000
commit17dba507b6fd48f389b022fa8bcef6cd7698423c (patch)
treec4391d1481feb6460765c0bf0934473b01c2383e
parenta30589d5dfe4c22ad7753a983046d71450cf6d6b (diff)
2016-12-13 Richard Biener <rguenther@suse.de>
PR middle-end/78742 * tree.c (cst_and_fits_in_hwi): Look if the actual value fits. * tree-object-size.c (compute_builtin_object_size): Use tree_fits_shwi_p. * tree-data-ref.c (initialize_matrix_A): Remove excess assert. * gcc.dg/torture/pr78742.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243598 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr78742.c20
-rw-r--r--gcc/tree-data-ref.c2
-rw-r--r--gcc/tree-object-size.c2
-rw-r--r--gcc/tree.c2
6 files changed, 35 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9ae13c5ed05..5e0562bbbef 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2016-12-13 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/78742
+ * tree.c (cst_and_fits_in_hwi): Look if the actual value fits.
+ * tree-object-size.c (compute_builtin_object_size): Use
+ tree_fits_shwi_p.
+ * tree-data-ref.c (initialize_matrix_A): Remove excess assert.
+
2016-12-13 Martin Liska <mliska@suse.cz>
* asan.c (asan_mark_poison_p): Remove.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ff7bd7868bc..6ad28bf9ce0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-12-13 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/78742
+ * gcc.dg/torture/pr78742.c: New testcase.
+
2016-12-13 Martin Liska <mliska@suse.cz>
* gcc.dg/asan/use-after-scope-goto-1.c: Update first argument of
diff --git a/gcc/testsuite/gcc.dg/torture/pr78742.c b/gcc/testsuite/gcc.dg/torture/pr78742.c
new file mode 100644
index 00000000000..c83ecbcb7d7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr78742.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target int128 } */
+
+void foo();
+
+void func()
+{
+ int m;
+
+ int tab[m];
+
+ __int128 j;
+ for(; j; j++)
+ {
+ tab[j] = 0;
+ tab[j+1] = 0;
+ }
+
+ foo();
+}
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 8152da3f180..1408c242f22 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -2118,8 +2118,6 @@ initialize_matrix_A (lambda_matrix A, tree chrec, unsigned index, int mult)
switch (TREE_CODE (chrec))
{
case POLYNOMIAL_CHREC:
- gcc_assert (TREE_CODE (CHREC_RIGHT (chrec)) == INTEGER_CST);
-
A[index][0] = mult * int_cst_value (CHREC_RIGHT (chrec));
return initialize_matrix_A (A, CHREC_LEFT (chrec), index + 1, mult);
diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
index 0fae183b330..f9c752198e0 100644
--- a/gcc/tree-object-size.c
+++ b/gcc/tree-object-size.c
@@ -538,7 +538,7 @@ compute_builtin_object_size (tree ptr, int object_size_type,
tree offset = gimple_assign_rhs2 (def);
ptr = gimple_assign_rhs1 (def);
- if (cst_and_fits_in_hwi (offset)
+ if (tree_fits_shwi_p (offset)
&& compute_builtin_object_size (ptr, object_size_type, psize))
{
/* Return zero when the offset is out of bounds. */
diff --git a/gcc/tree.c b/gcc/tree.c
index 0f0e6753b19..2a603866522 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1677,7 +1677,7 @@ bool
cst_and_fits_in_hwi (const_tree x)
{
return (TREE_CODE (x) == INTEGER_CST
- && TYPE_PRECISION (TREE_TYPE (x)) <= HOST_BITS_PER_WIDE_INT);
+ && (tree_fits_shwi_p (x) || tree_fits_uhwi_p (x)));
}
/* Build a newly constructed VECTOR_CST node of length LEN. */