public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-7681] PR c/98198: ICE-on-invalid-code error recovery.
@ 2022-03-16 23:21 Roger Sayle
  0 siblings, 0 replies; only message in thread
From: Roger Sayle @ 2022-03-16 23:21 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:4565a07a646949e6ce30a08c60484afe1fed0ac1

commit r12-7681-g4565a07a646949e6ce30a08c60484afe1fed0ac1
Author: Roger Sayle <roger@nextmovesoftware.com>
Date:   Wed Mar 16 23:20:34 2022 +0000

    PR c/98198: ICE-on-invalid-code error recovery.
    
    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.

Diff:
---
 gcc/c-family/c-attribs.cc      | 2 ++
 gcc/testsuite/gcc.dg/pr98198.c | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/gcc/c-family/c-attribs.cc b/gcc/c-family/c-attribs.cc
index c885d888a06..111a33f405a 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 00000000000..489afae9986
--- /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 "" } */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-16 23:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-16 23:21 [gcc r12-7681] PR c/98198: ICE-on-invalid-code error recovery Roger Sayle

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).