public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r10-7768] inliner: Don't ICE on NULL TYPE_DOMAIN [PR94621] Date: Fri, 17 Apr 2020 07:24:37 +0000 (GMT) [thread overview] Message-ID: <20200417072437.4E94E385DC1D@sourceware.org> (raw) https://gcc.gnu.org/g:c58cb6ac6891886b7aa01c440ac71a5e7cbcba97 commit r10-7768-gc58cb6ac6891886b7aa01c440ac71a5e7cbcba97 Author: Jakub Jelinek <jakub@redhat.com> Date: Fri Apr 17 09:07:49 2020 +0200 inliner: Don't ICE on NULL TYPE_DOMAIN [PR94621] When I've added the VLA tweak for OpenMP to avoid error_mark_nodes in the IL in type, I forgot that TYPE_DOMAIN could be NULL. Furthermore, as an optimization, this patch checks the hopefully cheapest condition that is very likely false most of the time (enabled only during OpenMP handling) first. 2020-04-17 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/94621 * tree-inline.c (remap_type_1): Don't dereference NULL TYPE_DOMAIN. Move id->adjust_array_error_bounds check first in the condition. * gcc.c-torture/compile/pr94621.c: New test. Diff: --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.c-torture/compile/pr94621.c | 16 ++++++++++++++++ gcc/tree-inline.c | 5 +++-- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 80a37618d75..80b0534ba51 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-04-17 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/94621 + * tree-inline.c (remap_type_1): Don't dereference NULL TYPE_DOMAIN. + Move id->adjust_array_error_bounds check first in the condition. + 2020-04-17 Martin Liska <mliska@suse.cz> Jonathan Yong <10walls@gmail.com> diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1341eb2745a..64181e4e532 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2020-04-17 Jakub Jelinek <jakub@redhat.com> + PR tree-optimization/94621 + * gcc.c-torture/compile/pr94621.c: New test. + PR c++/94314 * g++.dg/pr94314-4.C: Require c++14 rather than c++11. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr94621.c b/gcc/testsuite/gcc.c-torture/compile/pr94621.c new file mode 100644 index 00000000000..0d98dfd53a5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr94621.c @@ -0,0 +1,16 @@ +/* PR tree-optimization/94621 */ + +struct S { int c, e[]; }; + +static inline int +foo (struct S *m, int r, int c) +{ + int (*a)[][m->c] = (int (*)[][m->c])&m->e; + return (*a)[r][c]; +} + +void +bar (struct S *a) +{ + foo (a, 0, 0); +} diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index f095795f06f..26c23f504be 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -556,8 +556,9 @@ remap_type_1 (tree type, copy_body_data *id) /* For array bounds where we have decided not to copy over the bounds variable which isn't used in OpenMP/OpenACC region, change them to an uninitialized VAR_DECL temporary. */ - if (TYPE_MAX_VALUE (TYPE_DOMAIN (new_tree)) == error_mark_node - && id->adjust_array_error_bounds + if (id->adjust_array_error_bounds + && TYPE_DOMAIN (new_tree) + && TYPE_MAX_VALUE (TYPE_DOMAIN (new_tree)) == error_mark_node && TYPE_MAX_VALUE (TYPE_DOMAIN (type)) != error_mark_node) { tree v = create_tmp_var (TREE_TYPE (TYPE_DOMAIN (new_tree)));
reply other threads:[~2020-04-17 7:24 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=20200417072437.4E94E385DC1D@sourceware.org \ --to=jakub@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).