diff options
author | Marek Polacek <polacek@redhat.com> | 2022-12-16 12:28:43 -0500 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2022-12-19 11:16:42 -0500 |
commit | 68e51bd0a85794cd437d3e740357dfef84dc560d (patch) | |
tree | 78e5a14397cd632b4907f7206fe034b595132b2d /gcc/c-family | |
parent | 263c22a95bc9a0d80c4873c0291b0f938cea7310 (diff) | |
download | gcc-68e51bd0a85794cd437d3e740357dfef84dc560d.zip gcc-68e51bd0a85794cd437d3e740357dfef84dc560d.tar.gz gcc-68e51bd0a85794cd437d3e740357dfef84dc560d.tar.bz2 |
c-family: Fix ICE with -Wsuggest-attribute [PR98487]
Here we crash because check_function_format was using TREE_PURPOSE
directly rather than using get_attribute_name.
PR c/98487
gcc/c-family/ChangeLog:
* c-format.cc (check_function_format): Use get_attribute_name.
gcc/testsuite/ChangeLog:
* c-c++-common/Wsuggest-attribute-1.c: New test.
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/c-format.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/c-family/c-format.cc b/gcc/c-family/c-format.cc index 01adea4..08643c5 100644 --- a/gcc/c-family/c-format.cc +++ b/gcc/c-family/c-format.cc @@ -1215,7 +1215,7 @@ check_function_format (const_tree fn, tree attrs, int nargs, for (c = TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl)); c; c = TREE_CHAIN (c)) - if (is_attribute_p ("format", TREE_PURPOSE (c)) + if (is_attribute_p ("format", get_attribute_name (c)) && (decode_format_type (IDENTIFIER_POINTER (TREE_VALUE (TREE_VALUE (c)))) == info.format_type)) |