diff options
author | Richard Biener <rguenther@suse.de> | 2019-02-08 08:18:09 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2019-02-08 08:18:09 +0000 |
commit | 2536d696a3fc101af0b731c10351777c4c0f0bc1 (patch) | |
tree | bf1e19ccee00b2f9da1866a9d6b05ee9a70b6bb2 /gcc | |
parent | 1c93f6ce599f93f9845d0490010bca29848c21de (diff) | |
download | gcc-2536d696a3fc101af0b731c10351777c4c0f0bc1.zip gcc-2536d696a3fc101af0b731c10351777c4c0f0bc1.tar.gz gcc-2536d696a3fc101af0b731c10351777c4c0f0bc1.tar.bz2 |
re PR tree-optimization/89223 (internal compiler error: in int_cst_value, at tree.c:11226)
2019-02-08 Richard Biener <rguenther@suse.de>
PR middle-end/89223
* tree-data-ref.c (initialize_matrix_A): Fail if constant
doesn't fit in HWI.
(analyze_subscript_affine_affine): Handle failure from
initialize_matrix_A.
* gcc.dg/torture/pr89223.c: New testcase.
From-SVN: r268666
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr89223.c | 10 | ||||
-rw-r--r-- | gcc/tree-data-ref.c | 21 |
4 files changed, 40 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f2652a4..4e78ab6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-02-08 Richard Biener <rguenther@suse.de> + + PR middle-end/89223 + * tree-data-ref.c (initialize_matrix_A): Fail if constant + doesn't fit in HWI. + (analyze_subscript_affine_affine): Handle failure from + initialize_matrix_A. + 2019-02-08 Jakub Jelinek <jakub@redhat.com> * cfganal.c (pre_and_rev_post_order_compute_fn): Use fn instead of diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cb500f5..9f4296b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-02-08 Richard Biener <rguenther@suse.de> + + PR middle-end/89223 + * gcc.dg/torture/pr89223.c: New testcase. + 2019-02-07 David Malcolm <dmalcolm@redhat.com> PR tree-optimization/86637 diff --git a/gcc/testsuite/gcc.dg/torture/pr89223.c b/gcc/testsuite/gcc.dg/torture/pr89223.c new file mode 100644 index 0000000..1e82811 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr89223.c @@ -0,0 +1,10 @@ +/* { dg-do compile { target int128 } } */ + +int a[5]; +unsigned __int128 b; +void c() +{ + b = 4; + for (;; b--) + a[b] = ({ a[b + b]; }); +} diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 7d1f03c..e536b46 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -3191,6 +3191,8 @@ initialize_matrix_A (lambda_matrix A, tree chrec, unsigned index, int mult) switch (TREE_CODE (chrec)) { case POLYNOMIAL_CHREC: + if (!cst_and_fits_in_hwi (CHREC_RIGHT (chrec))) + return chrec_dont_know; A[index][0] = mult * int_cst_value (CHREC_RIGHT (chrec)); return initialize_matrix_A (A, CHREC_LEFT (chrec), index + 1, mult); @@ -3574,7 +3576,7 @@ analyze_subscript_affine_affine (tree chrec_a, tree *last_conflicts) { unsigned nb_vars_a, nb_vars_b, dim; - HOST_WIDE_INT init_a, init_b, gamma, gcd_alpha_beta; + HOST_WIDE_INT gamma, gcd_alpha_beta; lambda_matrix A, U, S; struct obstack scratch_obstack; @@ -3611,9 +3613,20 @@ analyze_subscript_affine_affine (tree chrec_a, A = lambda_matrix_new (dim, 1, &scratch_obstack); S = lambda_matrix_new (dim, 1, &scratch_obstack); - init_a = int_cst_value (initialize_matrix_A (A, chrec_a, 0, 1)); - init_b = int_cst_value (initialize_matrix_A (A, chrec_b, nb_vars_a, -1)); - gamma = init_b - init_a; + tree init_a = initialize_matrix_A (A, chrec_a, 0, 1); + tree init_b = initialize_matrix_A (A, chrec_b, nb_vars_a, -1); + if (init_a == chrec_dont_know + || init_b == chrec_dont_know) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, "affine-affine test failed: " + "representation issue.\n"); + *overlaps_a = conflict_fn_not_known (); + *overlaps_b = conflict_fn_not_known (); + *last_conflicts = chrec_dont_know; + goto end_analyze_subs_aa; + } + gamma = int_cst_value (init_b) - int_cst_value (init_a); /* Don't do all the hard work of solving the Diophantine equation when we already know the solution: for example, |