aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c-attribs.cc
diff options
context:
space:
mode:
authorRoger Sayle <roger@nextmovesoftware.com>2022-03-16 23:20:34 +0000
committerRoger Sayle <roger@nextmovesoftware.com>2022-03-16 23:20:34 +0000
commit4565a07a646949e6ce30a08c60484afe1fed0ac1 (patch)
tree72da3a6e91a310bcfe9b9ab8995c5f67cc32a4fd /gcc/c-family/c-attribs.cc
parent732e4a75fe792182f171bba348a665e8b8d21176 (diff)
downloadgcc-4565a07a646949e6ce30a08c60484afe1fed0ac1.zip
gcc-4565a07a646949e6ce30a08c60484afe1fed0ac1.tar.gz
gcc-4565a07a646949e6ce30a08c60484afe1fed0ac1.tar.bz2
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.
Diffstat (limited to 'gcc/c-family/c-attribs.cc')
-rw-r--r--gcc/c-family/c-attribs.cc2
1 files changed, 2 insertions, 0 deletions
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);
}