* [PATCH] tree-optimization/113602 - datarefs of non-addressables
@ 2024-01-26 10:22 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2024-01-26 10:22 UTC (permalink / raw)
To: gcc-patches
We can end up creating ADDR_EXPRs of non-addressable entities during
for example vectorization. The following plugs this in data-ref
analysis when that would create such invalid ADDR_EXPR as part of
analyzing the ref structure.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
PR tree-optimization/113602
* tree-vect-data-ref.cc (dr_analyze_innermost): Fail when
the base object isn't addressable.
* gcc.dg/pr113602.c: New testcase.
---
gcc/testsuite/gcc.dg/pr113602.c | 10 ++++++++++
gcc/tree-data-ref.cc | 7 ++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.dg/pr113602.c
diff --git a/gcc/testsuite/gcc.dg/pr113602.c b/gcc/testsuite/gcc.dg/pr113602.c
new file mode 100644
index 00000000000..94bfbc91b5f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr113602.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target bitint575 } */
+/* { dg-options "-O2 -fno-tree-loop-optimize" } */
+
+_BitInt(503)
+f(void)
+{
+ register _BitInt(503) r asm(""); /* { dg-error "invalid" } */
+ return r;
+}
diff --git a/gcc/tree-data-ref.cc b/gcc/tree-data-ref.cc
index ae55bf6aa48..f37734b5340 100644
--- a/gcc/tree-data-ref.cc
+++ b/gcc/tree-data-ref.cc
@@ -1182,7 +1182,12 @@ dr_analyze_innermost (innermost_loop_behavior *drb, tree ref,
base = TREE_OPERAND (base, 0);
}
else
- base = build_fold_addr_expr (base);
+ {
+ if (may_be_nonaddressable_p (base))
+ return opt_result::failure_at (stmt,
+ "failed: base not addressable.\n");
+ base = build_fold_addr_expr (base);
+ }
if (in_loop)
{
--
2.35.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-01-26 10:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-26 10:22 [PATCH] tree-optimization/113602 - datarefs of non-addressables 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).