public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "s_gccbugzilla at nedprod dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95001] New: std::terminate() and abort() do not have __builtin_unreachable() semantics Date: Fri, 08 May 2020 09:07:14 +0000 [thread overview] Message-ID: <bug-95001-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95001 Bug ID: 95001 Summary: std::terminate() and abort() do not have __builtin_unreachable() semantics Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: s_gccbugzilla at nedprod dot com Target Milestone: --- Consider the codegen from https://godbolt.org/z/xhmBrL: ``` #include <cstddef> #include <cstdint> #include <cstdlib> #include <exception> void sum(uint32_t *__restrict a, const uint32_t *__restrict b, const uint32_t *__restrict c, size_t count) { auto invoke_terminate = []{ #ifdef USE_UNREACHABLE __builtin_unreachable(); #else std::terminate(); #endif }; if((((uintptr_t)a) & 15)!=0) invoke_terminate(); if((((uintptr_t)b) & 15)!=0) invoke_terminate(); if((((uintptr_t)c) & 15)!=0) invoke_terminate(); if((count & 15) != 0) invoke_terminate(); while(count != 0) { *a++ = *b++ + *c++; count--; } } ``` It would seem that functions marked with both [[noreturn]] and noexcept do not have the same improvements on codegen as __builtin_unreachable() has. This is despite that [[noreturn]] functions returning is explicitly required to be UB in the standard, and if they are noexcept then they cannot throw an exception either. Can noexcept functions marked [[noreturn]] please gain the same effects on codegen as __builtin_unreachable() has please?
next reply other threads:[~2020-05-08 9:07 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-05-08 9:07 s_gccbugzilla at nedprod dot com [this message] 2020-05-08 9:44 ` [Bug tree-optimization/95001] " pinskia at gcc dot gnu.org 2020-05-08 11:26 ` rguenth at gcc dot gnu.org 2020-05-08 11:43 ` jakub at gcc dot gnu.org 2020-05-08 12:16 ` glisse at gcc dot gnu.org 2020-05-08 12:24 ` jakub at gcc dot gnu.org 2020-05-08 12:42 ` s_gccbugzilla at nedprod dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-95001-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).