]> git.ipfire.org Git - thirdparty/gcc.git/commit
attribs: Don't crash on NULL TREE_TYPE in diag_attr_exclusions [PR114634]
authorJakub Jelinek <jakub@redhat.com>
Mon, 15 Apr 2024 08:25:22 +0000 (10:25 +0200)
committerJakub Jelinek <jakub@redhat.com>
Thu, 20 Jun 2024 13:07:40 +0000 (15:07 +0200)
commit139f129bf4f0d40f1e6fb619c044bc0ef699a014
treefb7977d29a29c9042f544fb54816edf373f9b5c5
parent6ec50f5b9a8842f92d65dbd8fcc546f0f6902585
attribs: Don't crash on NULL TREE_TYPE in diag_attr_exclusions [PR114634]

The enumerator still doesn't have TREE_TYPE set but diag_attr_exclusions
assumes that all decls must have types.
I think it is better in something as unimportant as diag_attr_exclusions
to be more robust, if there is no type, it can just diagnose exclusions
on the DECL_ATTRIBUTES, like for types it only diagnoses it on
TYPE_ATTRIBUTES.

2024-04-15  Jakub Jelinek  <jakub@redhat.com>

PR c++/114634
* attribs.c (diag_attr_exclusions): Set attrs[1] to NULL_TREE for
decls with NULL TREE_TYPE.

* g++.dg/ext/attrib68.C: New test.

(cherry picked from commit 7ec54f5fdfec298812a749699874db4d6a7246bb)
gcc/attribs.c
gcc/testsuite/g++.dg/ext/attrib68.C [new file with mode: 0644]