c-family: fix attribute constructor ICE [PR90658]
commitca4b95069ca7dbf0be3a5aae053631e7a1b20103
authorMarek Polacek <polacek@redhat.com>
Thu, 26 May 2022 22:59:44 +0000 (26 18:59 -0400)
committerMarek Polacek <polacek@redhat.com>
Fri, 27 May 2022 15:55:19 +0000 (27 11:55 -0400)
treea94f827466bf6d98d102873f8b277348da87c246
parentde57440858591a88e8fd7ba2505ca54546c86021
c-family: fix attribute constructor ICE [PR90658]

Here the C compiler crashes because a FUNCTION_DECL got into
get_priority -> default_conversion, and the C FE's version of d_c
specifically asserts that it doesn't get a FUNCTION_DECL.  All uses
of default_conversion in c-attribs.cc are guarded by != IDENTIFIER_NODE
&& != FUNCTION_DECL, but get_priority was only checking IDENTIFIER_NODE.

PR c/90658

gcc/c-family/ChangeLog:

* c-attribs.cc (get_priority): Check FUNCTION_DECL.

gcc/testsuite/ChangeLog:

* c-c++-common/attr-cdtor-1.c: New test.
gcc/c-family/c-attribs.cc
gcc/testsuite/c-c++-common/attr-cdtor-1.c [new file with mode: 0644]