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 r9-9444] c: Avoid clobbering TREE_TYPE (error_mark_node) [PR99990] Date: Tue, 20 Apr 2021 23:34:32 +0000 (GMT) [thread overview] Message-ID: <20210420233432.384123AA9421@sourceware.org> (raw) https://gcc.gnu.org/g:9861f00a08a5f5fecd2c1c4135d3d540b0ed9cc7 commit r9-9444-g9861f00a08a5f5fecd2c1c4135d3d540b0ed9cc7 Author: Jakub Jelinek <jakub@redhat.com> Date: Sat Apr 10 17:01:54 2021 +0200 c: Avoid clobbering TREE_TYPE (error_mark_node) [PR99990] The following testcase ICEs during error recovery, because finish_decl overwrites TREE_TYPE (error_mark_node), which better should stay always to be error_mark_node. 2021-04-10 Jakub Jelinek <jakub@redhat.com> PR c/99990 * c-decl.c (finish_decl): Don't overwrite TREE_TYPE of error_mark_node. * gcc.dg/pr99990.c: New test. (cherry picked from commit 91e076f3a66c1c9f6aa51e9d53d07803606e3bf1) Diff: --- gcc/c/c-decl.c | 2 +- gcc/testsuite/gcc.dg/pr99990.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 80071112130..e1e765e29e9 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -5180,7 +5180,7 @@ finish_decl (tree decl, location_t init_loc, tree init, gcc_unreachable (); } - if (DECL_INITIAL (decl)) + if (DECL_INITIAL (decl) && DECL_INITIAL (decl) != error_mark_node) TREE_TYPE (DECL_INITIAL (decl)) = type; relayout_decl (decl); diff --git a/gcc/testsuite/gcc.dg/pr99990.c b/gcc/testsuite/gcc.dg/pr99990.c new file mode 100644 index 00000000000..6878b00ce0d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr99990.c @@ -0,0 +1,12 @@ +/* PR c/99990 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +#include <stdarg.h> + +void +foo () +{ + va_arg (0, long); /* { dg-error "first argument to 'va_arg' not of type 'va_list'" } */ + void *b[] = 0; /* { dg-error "invalid initializer" } */ +}
reply other threads:[~2021-04-20 23:34 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=20210420233432.384123AA9421@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).