https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88397
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2018-12-07 Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- Based on quick review of c-attribs.c it looks like attributes noreturn and nothrow suffer from the same limitation as malloc. It should be easy to fix. I'm testing the patch below. If it doesn't cause major problems I'll add tests, update the manual, and post it. Index: gcc/c-family/c-attribs.c =================================================================== --- gcc/c-family/c-attribs.c (revision 266881) +++ gcc/c-family/c-attribs.c (working copy) @@ -257,7 +257,7 @@ const struct attribute_spec c_common_attribute_tab would require all the places in the compiler that use TREE_THIS_VOLATILE on a decl to identify non-returning functions to be located and fixed to check the function type instead. */ - { "noreturn", 0, 0, true, false, false, false, + { "noreturn", 0, 0, false, true, true, false, handle_noreturn_attribute, attr_noreturn_exclusions }, { "volatile", 0, 0, true, false, false, false, @@ -330,7 +330,7 @@ const struct attribute_spec c_common_attribute_tab { "no_profile_instrument_function", 0, 0, true, false, false, false, handle_no_profile_instrument_function_attribute, NULL }, - { "malloc", 0, 0, true, false, false, false, + { "malloc", 0, 0, false, true, true, false, handle_malloc_attribute, attr_alloc_exclusions }, { "returns_twice", 0, 0, true, false, false, false, handle_returns_twice_attribute, @@ -372,7 +372,7 @@ const struct attribute_spec c_common_attribute_tab handle_nonnull_attribute, NULL }, { "nonstring", 0, 0, true, false, false, false, handle_nonstring_attribute, NULL }, - { "nothrow", 0, 0, true, false, false, false, + { "nothrow", 0, 0, false, true, true, false, handle_nothrow_attribute, NULL }, { "may_alias", 0, 0, false, true, false, false, NULL, NULL }, { "cleanup", 1, 1, true, false, false, false,