tree-optimization/113602 - datarefs of non-addressables

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.

	PR tree-optimization/113602
	* tree-data-ref.cc (dr_analyze_innermost): Fail when
	the base object isn't addressable.

	* gcc.dg/pr113602.c: New testcase.
This commit is contained in:
Richard Biener 2024-01-26 09:29:22 +01:00
parent 4b5650acb3
commit f9b143d239
2 changed files with 16 additions and 1 deletions

View File

@ -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;
}

View File

@ -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)
{