From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 82B1A395CC4D; Fri, 8 May 2020 09:07:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 82B1A395CC4D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588928834; bh=XIqdzTEaytE21512Z9Zfbx8goMXQJJejDoZb4NtThjc=; h=From:To:Subject:Date:From; b=YLT+dJCKKsbi8qebmkykOUfrBHHrfgQzlSrxtxktj787lSaWpIuBhEUMyi5q3Q6XP J921W9uSUJFq0thUrMKmicnsp71ioZ1lRyU+IwqUYLOPA8MEES1pAIYLJYnv7L+rzE MwS9wWVjzrv5f+cVndAJoq8RXawzcTgH8S2n7A4M= From: "s_gccbugzilla at nedprod dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: s_gccbugzilla at nedprod dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 May 2020 09:07:14 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95001 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 #include #include #include void sum(uint32_t *__restrict a, const uint32_t *__restrict b, const uint32= _t *__restrict c, size_t count) { auto invoke_terminate =3D []{ #ifdef USE_UNREACHABLE __builtin_unreachable(); #else std::terminate(); #endif }; if((((uintptr_t)a) & 15)!=3D0) invoke_terminate(); if((((uintptr_t)b) & 15)!=3D0) invoke_terminate(); if((((uintptr_t)c) & 15)!=3D0) invoke_terminate(); if((count & 15) !=3D 0) invoke_terminate(); while(count !=3D 0) { *a++ =3D *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 excepti= on either. Can noexcept functions marked [[noreturn]] please gain the same effects on codegen as __builtin_unreachable() has please?=