public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] tree-optimization/112495 - alias versioning and address spaces
@ 2023-11-13 13:38 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-11-13 13:38 UTC (permalink / raw)
  To: gcc-patches

We are not correctly handling differing address spaces in dependence
analysis runtime alias check generation so refuse to do that.

Bootstrapped and tested on x86_64-unknown-linux-gnu.  I'm double-checking
hundreds of ACATS FAILs (segfaults), will push if those are latent.

Richard.

	PR tree-optimization/112495
	* tree-data-ref.cc (runtime_alias_check_p): Reject checks
	between different address spaces.

	* gcc.target/i386/pr112495.c: New testcase.
---
 gcc/testsuite/gcc.target/i386/pr112495.c | 12 ++++++++++++
 gcc/tree-data-ref.cc                     |  7 +++++++
 2 files changed, 19 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr112495.c

diff --git a/gcc/testsuite/gcc.target/i386/pr112495.c b/gcc/testsuite/gcc.target/i386/pr112495.c
new file mode 100644
index 00000000000..21afbaa6945
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr112495.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+typedef struct { int v; } T1;
+typedef struct { T1 v[32]; } T2;
+
+T1 s;
+T1 f1() { return s; }
+
+void f2(__seg_gs T2 *p, int n) {
+  for (int i = 0; i < n; ++i) p->v[i] = f1();
+}
diff --git a/gcc/tree-data-ref.cc b/gcc/tree-data-ref.cc
index 689aaeed722..3549485d251 100644
--- a/gcc/tree-data-ref.cc
+++ b/gcc/tree-data-ref.cc
@@ -1640,6 +1640,13 @@ runtime_alias_check_p (ddr_p ddr, class loop *loop, bool speed_p)
 				   "runtime alias check not supported for"
 				   " outer loop.\n");
 
+  /* FORNOW: We don't support handling different address spaces.  */
+  if (TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (DR_BASE_ADDRESS (DDR_A (ddr)))))
+      != TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (DR_BASE_ADDRESS (DDR_B (ddr))))))
+    return opt_result::failure_at (DR_STMT (DDR_A (ddr)),
+				   "runtime alias check between different "
+				   "address spaces not supported.\n");
+
   return opt_result::success ();
 }
 
-- 
2.35.3

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-13 13:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-13 13:38 [PATCH] tree-optimization/112495 - alias versioning and address spaces Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).