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-9135] tree-optimization/114048 - ICE in copy_reference_ops_from_ref Date: Thu, 22 Feb 2024 14:48:22 +0000 (GMT) [thread overview] Message-ID: <20240222144822.2B3DD3858413@sourceware.org> (raw) https://gcc.gnu.org/g:92c40297991f51e7fa942f29517bc4398fce33f9 commit r14-9135-g92c40297991f51e7fa942f29517bc4398fce33f9 Author: Richard Biener <rguenther@suse.de> Date: Thu Feb 22 14:22:29 2024 +0100 tree-optimization/114048 - ICE in copy_reference_ops_from_ref The following adds another omission to the assert verifying we're not running into spurious off == -1. PR tree-optimization/114048 * tree-ssa-sccvn.cc (copy_reference_ops_from_ref): MEM_REF can also produce -1 off. * gcc.dg/torture/pr114048.c: New testcase. Diff: --- gcc/testsuite/gcc.dg/torture/pr114048.c | 25 +++++++++++++++++++++++++ gcc/tree-ssa-sccvn.cc | 2 ++ 2 files changed, 27 insertions(+) diff --git a/gcc/testsuite/gcc.dg/torture/pr114048.c b/gcc/testsuite/gcc.dg/torture/pr114048.c new file mode 100644 index 000000000000..338000b30062 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr114048.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ + +typedef struct { + void *child[2]; + char otherbits; +} critbit0_node; + +int allprefixed_traverse(char *top) +{ + if (top) + { + critbit0_node *q = (void *)top - 1; + int direction = 0; + for (;; ++direction) + switch (allprefixed_traverse(q->child[direction])) + { + case 1: + break; + case 0: + return 0; + default: + return 1; + } + } +} diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc index 3e93685e80a6..2587eb1c5052 100644 --- a/gcc/tree-ssa-sccvn.cc +++ b/gcc/tree-ssa-sccvn.cc @@ -1185,6 +1185,8 @@ copy_reference_ops_from_ref (tree ref, vec<vn_reference_op_s> *result) else { gcc_assert (known_ne (op.off, -1) + /* The constant offset can be -1. */ + || op.opcode == MEM_REF /* Out-of-bound indices can compute to a known -1 offset. */ || ((op.opcode == ARRAY_REF
reply other threads:[~2024-02-22 14:48 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=20240222144822.2B3DD3858413@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).