diff options
author | Jakub Jelinek <jakub@redhat.com> | 2020-04-23 09:54:14 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2020-04-23 09:54:14 +0200 |
commit | e2a71816b4949225498bec37e947293aa7f5841b (patch) | |
tree | e4fc947b0d1b948672080b498981a07afe09841d /gcc/attribs.c | |
parent | 49fc9f36a36e228c4fafb1a6a99fcfef83ff048e (diff) | |
download | gcc-e2a71816b4949225498bec37e947293aa7f5841b.zip gcc-e2a71816b4949225498bec37e947293aa7f5841b.tar.gz gcc-e2a71816b4949225498bec37e947293aa7f5841b.tar.bz2 |
attribs: Don't diagnose attribute exclusions during error recovery [PR94705]
On the following testcase GCC ICEs, because last_decl is error_mark_node,
and diag_attr_exclusions assumes that if it is not NULL, it must be a decl.
The following patch just doesn't diagnose attribute exclusions if the
other decl is erroneous (and thus we've already reported errors for it).
2020-04-23 Jakub Jelinek <jakub@redhat.com>
PR c/94705
* attribs.c (decl_attribute): Don't diagnose attribute exclusions
if last_decl is error_mark_node or has such a TREE_TYPE.
* gcc.dg/pr94705.c: New test.
Diffstat (limited to 'gcc/attribs.c')
-rw-r--r-- | gcc/attribs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/attribs.c b/gcc/attribs.c index c66d4ae..7d0f4b5 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -677,7 +677,8 @@ decl_attributes (tree *node, tree attributes, int flags, reject incompatible attributes. */ bool built_in = flags & ATTR_FLAG_BUILT_IN; if (spec->exclude - && (flag_checking || !built_in)) + && (flag_checking || !built_in) + && !error_operand_p (last_decl)) { /* Always check attributes on user-defined functions. Check them on built-ins only when -fchecking is set. |