From: "Roger Sayle" <roger@nextmovesoftware.com>
To: "'GCC Patches'" <gcc-patches@gcc.gnu.org>
Subject: [C PATCH] PR c/98198: ICE-on-invalid-code error recovery.
Date: Wed, 16 Mar 2022 16:20:29 -0000 [thread overview]
Message-ID: <003401d83951$c1614060$4423c120$@nextmovesoftware.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 541 bytes --]
This is Christophe Lyon's fix to PR c/98198, an ICE-on-invalid-code
regression affecting mainline, and a suitable testcase.
Tested on x86_64-pc-linux-gnu with make bootstrap and make -k check
with no new failures. Ok for mainline?
2022-03-16 Christophe Lyon <christophe.lyon@arm.com>
Roger Sayle <roger@nextmovesoftware.com>
gcc/c-family/ChangeLog
PR c/98198
* c-attribs.cc (decl_or_type_attrs): Add error_mark_node check.
gcc/testsuite/ChangeLog
PR c/98198
* gcc.dg/pr98198.c: New test case.
Thanks in advance,
Roger
--
[-- Attachment #2: patchce.txt --]
[-- Type: text/plain, Size: 777 bytes --]
diff --git a/gcc/c-family/c-attribs.cc b/gcc/c-family/c-attribs.cc
index c885d88..111a33f 100644
--- a/gcc/c-family/c-attribs.cc
+++ b/gcc/c-family/c-attribs.cc
@@ -806,6 +806,8 @@ decl_or_type_attrs (tree node)
return attrs;
tree type = TREE_TYPE (node);
+ if (type == error_mark_node)
+ return NULL_TREE;
return TYPE_ATTRIBUTES (type);
}
diff --git a/gcc/testsuite/gcc.dg/pr98198.c b/gcc/testsuite/gcc.dg/pr98198.c
new file mode 100644
index 0000000..489afae
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr98198.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+static inline void sub_1 ( ) {
+ struct struct_1 var_9 , var_10
+}
+
+static int var_9[1] __attribute__ ( ( section ( ".data" ) ) ) ;
+/* { dg-excess-errors "" } */
next reply other threads:[~2022-03-16 16:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-16 16:20 Roger Sayle [this message]
2022-03-16 17:57 ` Joseph Myers
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='003401d83951$c1614060$4423c120$@nextmovesoftware.com' \
--to=roger@nextmovesoftware.com \
--cc=gcc-patches@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: link
Be 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).