Here's another fix for a missing check that an IV value fits in a HIW. It's originally from Stefan.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. PR tree-optimization/117119 * tree-data-ref.cc (initialize_matrix_A): Check whether an INTEGER_CST fits in HWI, otherwise return chrec_dont_know. * gcc.dg/torture/pr117119.c: New testcase. Co-Authored-By: Stefan Schulze Frielinghaus <stefa...@linux.ibm.com> --- gcc/testsuite/gcc.dg/torture/pr117119.c | 10 ++++++++++ gcc/tree-data-ref.cc | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr117119.c diff --git a/gcc/testsuite/gcc.dg/torture/pr117119.c b/gcc/testsuite/gcc.dg/torture/pr117119.c new file mode 100644 index 00000000000..0ec4ac1b180 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr117119.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target int128 } */ + +unsigned __int128 g_728; +int func_1_l_5011[8]; +void func_1() { + for (;; g_728 += 1) + func_1_l_5011[g_728] ^= func_1_l_5011[g_728 + 5]; +} +void main() {} diff --git a/gcc/tree-data-ref.cc b/gcc/tree-data-ref.cc index 26ad0536c36..08c14fe29f2 100644 --- a/gcc/tree-data-ref.cc +++ b/gcc/tree-data-ref.cc @@ -4088,7 +4088,7 @@ initialize_matrix_A (lambda_matrix A, tree chrec, unsigned index, int mult) } case INTEGER_CST: - return chrec; + return cst_and_fits_in_hwi (chrec) ? chrec : chrec_dont_know; default: gcc_unreachable (); -- 2.43.0