public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-4966] Fix ice in insert_access Date: Fri, 5 Nov 2021 22:33:25 +0000 (GMT) [thread overview] Message-ID: <20211105223325.72C9C3858414@sourceware.org> (raw) https://gcc.gnu.org/g:5f37780372212a7245f0528e46dbeb741316bba1 commit r12-4966-g5f37780372212a7245f0528e46dbeb741316bba1 Author: Jan Hubicka <hubicka@ucw.cz> Date: Fri Nov 5 23:32:55 2021 +0100 Fix ice in insert_access gcc/ChangeLog: PR ipa/103073 * ipa-modref-tree.h (modref_tree::insert): Do nothing for paradoxical and zero sized accesses. gcc/testsuite/ChangeLog: PR ipa/103073 * g++.dg/torture/pr103073.C: New test. * gcc.dg/tree-ssa/modref-11.c: New test. Diff: --- gcc/ipa-modref-tree.h | 30 ++++++++++++++++++++++++++++++ gcc/testsuite/g++.dg/torture/pr103073.C | 8 ++++++++ gcc/testsuite/gcc.dg/tree-ssa/modref-11.c | 13 +++++++++++++ 3 files changed, 51 insertions(+) diff --git a/gcc/ipa-modref-tree.h b/gcc/ipa-modref-tree.h index bc428d193d2..54ae9e1df4e 100644 --- a/gcc/ipa-modref-tree.h +++ b/gcc/ipa-modref-tree.h @@ -818,6 +818,36 @@ struct GTY((user)) modref_tree bool changed = false; + /* We may end up with max_size being less than size for accesses past the + end of array. Those are undefined and safe to ignore. */ + if (a.range_info_useful_p () + && known_size_p (a.size) && known_size_p (a.max_size) + && known_lt (a.max_size, a.size)) + { + if (dump_file) + fprintf (dump_file, + " - Paradoxical range. Ignoring\n"); + return false; + } + if (known_size_p (a.size) + && known_eq (a.size, 0)) + { + if (dump_file) + fprintf (dump_file, + " - Zero size. Ignoring\n"); + return false; + } + if (known_size_p (a.max_size) + && known_eq (a.max_size, 0)) + { + if (dump_file) + fprintf (dump_file, + " - Zero max_size. Ignoring\n"); + return false; + } + gcc_checking_assert (!known_size_p (a.max_size) + || !known_le (a.max_size, 0)); + /* No useful information tracked; collapse everything. */ if (!base && !ref && !a.useful_p ()) { diff --git a/gcc/testsuite/g++.dg/torture/pr103073.C b/gcc/testsuite/g++.dg/torture/pr103073.C new file mode 100644 index 00000000000..02b1eee064a --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr103073.C @@ -0,0 +1,8 @@ +// { dg-do compile } +int a; +void b(bool c[], char d[], bool g[][55][21]) { + for (signed e = 0; e < 11; e += 3) + for (unsigned f = c[0] + 1; f < d[0]; f += 3) + a = g[0][e][f + 2]; +} + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/modref-11.c b/gcc/testsuite/gcc.dg/tree-ssa/modref-11.c new file mode 100644 index 00000000000..de9ad16879f --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/modref-11.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-modref1" } */ +struct linkedlist { + struct linkedlist *next; +}; +struct linkedlist * +find_last (struct linkedlist *l) +{ + while (l->next) + l = l->next; + return l; +} +/* { dg-final { scan-tree-dump "noclobber noescape nodirectescape" "modref1"} } */
reply other threads:[~2021-11-05 22:33 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=20211105223325.72C9C3858414@sourceware.org \ --to=hubicka@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).