https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121923
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- /* { name, min_len, max_len, decl_req, type_req, fn_type_req, affects_type_identity, handler, exclude } */ { "no_sanitize", 1, -1, true, false, false, false, handle_no_sanitize_attribute, NULL }, So we currently don't support it on non function decls it seem: if (TREE_CODE (*node) != FUNCTION_DECL) { warning (OPT_Wattributes, "%qE attribute ignored", name); return NULL_TREE; } But that is different from clang ...