From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id 3EC283858291; Fri, 26 Jan 2024 10:25:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3EC283858291 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706264736; bh=h3I/lA+8Dq1ueYLG0C8VLyCvuPxeptYT6iJFXFC7Y+k=; h=From:To:Subject:Date:From; b=PaU/HbvuY1wxlKDfAUm4bqLSj3MDdpibLznGwA/cU9DnlpiABjFG0onxCRH5kUqX/ mxTMpqispkzpGnVW3dDHXA879yABY8cq8i7aRhLnJcErGdNP5f8yKwLI2eUyDEUGMG Au+BvnzDuvzl8WqzIAaKB87FnSFI0XTLwv0eYhOg= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8450] tree-optimization/113602 - datarefs of non-addressables X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/master X-Git-Oldrev: 4b5650acb3107239867830dc1214b31bdbe3cacd X-Git-Newrev: f9b143d239db775318a29e9ff63f232b9501a22a Message-Id: <20240126102536.3EC283858291@sourceware.org> Date: Fri, 26 Jan 2024 10:25:36 +0000 (GMT) List-Id: https://gcc.gnu.org/g:f9b143d239db775318a29e9ff63f232b9501a22a commit r14-8450-gf9b143d239db775318a29e9ff63f232b9501a22a Author: Richard Biener Date: Fri Jan 26 09:29:22 2024 +0100 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. Diff: --- gcc/testsuite/gcc.dg/pr113602.c | 10 ++++++++++ gcc/tree-data-ref.cc | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.dg/pr113602.c b/gcc/testsuite/gcc.dg/pr113602.c new file mode 100644 index 000000000000..94bfbc91b5f4 --- /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 ae55bf6aa481..f37734b53409 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) {