]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/117119 - ICE with int128 IV in dataref analysis
authorRichard Biener <rguenther@suse.de>
Mon, 13 Jan 2025 08:12:23 +0000 (09:12 +0100)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 13 Jan 2025 09:38:47 +0000 (10:38 +0100)
Here's another fix for a missing check that an IV value fits in a
HIW.  It's originally from Stefan.

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 <stefansf@linux.ibm.com>
gcc/testsuite/gcc.dg/torture/pr117119.c [new file with mode: 0644]
gcc/tree-data-ref.cc

diff --git a/gcc/testsuite/gcc.dg/torture/pr117119.c b/gcc/testsuite/gcc.dg/torture/pr117119.c
new file mode 100644 (file)
index 0000000..0ec4ac1
--- /dev/null
@@ -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() {}
index 26ad0536c360207aa2a2167200f0bd49d2e8fc12..08c14fe29f22950ef33f17db21b78707ecc20076 100644 (file)
@@ -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 ();