public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-4677] tree-optimization/111807 - ICE in verify_sra_access_forest Date: Tue, 17 Oct 2023 06:26:33 +0000 (GMT) [thread overview] Message-ID: <20231017062633.124053857B8E@sourceware.org> (raw) https://gcc.gnu.org/g:3aaf704bca3e01c72d9fe6de01ae5416dba6b5db commit r14-4677-g3aaf704bca3e01c72d9fe6de01ae5416dba6b5db Author: Richard Biener <rguenther@suse.de> Date: Mon Oct 16 12:54:28 2023 +0200 tree-optimization/111807 - ICE in verify_sra_access_forest The following addresses build_reconstructed_reference failing to build references with a different offset than the models and thus the caller conditional being off. This manifests when attempting to build a ref with offset 160 from the model BIT_FIELD_REF <l_4827[9], 8, 0> onto the same base l_4827 but the models offset being 288. This cannot work for any kind of ref I can think of, not just with BIT_FIELD_REFs. PR tree-optimization/111807 * tree-sra.cc (build_ref_for_model): Only call build_reconstructed_reference when the offsets are the same. * gcc.dg/torture/pr111807.c: New testcase. Diff: --- gcc/testsuite/gcc.dg/torture/pr111807.c | 12 ++++++++++++ gcc/tree-sra.cc | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.dg/torture/pr111807.c b/gcc/testsuite/gcc.dg/torture/pr111807.c new file mode 100644 index 000000000000..09fbdcfb667a --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr111807.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ + +static struct A { + int x : 4; +} a; +static int b; +int main() +{ + struct A t[2]; + t[0] = b ? t[1] : a; + return (b ? t[1].x : 0) && 1; +} diff --git a/gcc/tree-sra.cc b/gcc/tree-sra.cc index 24d0c20da6ae..f8dff8b27d76 100644 --- a/gcc/tree-sra.cc +++ b/gcc/tree-sra.cc @@ -1751,7 +1751,7 @@ build_ref_for_model (location_t loc, tree base, HOST_WIDE_INT offset, && !TREE_THIS_VOLATILE (base) && (TYPE_ADDR_SPACE (TREE_TYPE (base)) == TYPE_ADDR_SPACE (TREE_TYPE (model->expr))) - && offset <= model->offset + && offset == model->offset /* build_reconstructed_reference can still fail if we have already massaged BASE because of another type incompatibility. */ && (res = build_reconstructed_reference (loc, base, model)))
reply other threads:[~2023-10-17 6:26 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20231017062633.124053857B8E@sourceware.org \ --to=rguenth@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).