The followng fixes the data-ref code not properly checking whether it can handle some constants.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2019-02-08 Richard Biener <rguent...@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. Index: gcc/tree-data-ref.c =================================================================== --- gcc/tree-data-ref.c (revision 268609) +++ gcc/tree-data-ref.c (working copy) @@ -3191,6 +3191,8 @@ initialize_matrix_A (lambda_matrix A, tr 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 ch 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 ch 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, Index: gcc/testsuite/gcc.dg/torture/pr89223.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr89223.c (nonexistent) +++ gcc/testsuite/gcc.dg/torture/pr89223.c (working copy) @@ -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]; }); +}