https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84210
Bug ID: 84210 Summary: __ubsan_handle_builtin_unreachable shoun't be const Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: ryabinin.a.a at gmail dot com CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org Target Milestone: --- Compiling the linux kernel with gcc-8 gives this warning: lib/ubsan.c:432:1: error: ignoring attribute 'noreturn' in declaration of a built-in function '__ubsan_handle_builtin_unreachable' because it conflicts with attribute 'const' [-Werror=attributes] It seems that GCC defines __ubsan_handle_builtin_unreachable with noreturn and const attributes: DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_BUILTIN_UNREACHABLE, "__ubsan_handle_builtin_unreachable", BT_FN_VOID_PTR, ATTR_COLD_CONST_NORETURN_NOTHROW_LEAF_LIST) And const doesn't make any sense for function that returns void or doesn't return at all. Shouldn't it be just ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST ?