From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 197593858C56; Wed, 6 Dec 2023 16:47:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 197593858C56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701881221; bh=GJctFyp4SMQWG+jTS4cO+jQCsnEz8axUX8jNmtu9fKU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GJKbJpxzdnSHg8c+HLmFgasXo4i2rXOoVzus6ut7Cw1sxQIocnf9cBgfGhz/6GCDF Bq8jA6YXQTXR4ypsCeb+h7GFU+c9dE7ebOde7fSSIs1GE9n5l+EW+TUQaYhF/e8fRW aYNQASFiPYFe11dLW56yd4kuME4XPgqPtlBkfvTI= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/112882] [14 Regression] std::clamp no longer usable in header only mode Date: Wed, 06 Dec 2023 16:47:00 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: NEW 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: everconfirmed cf_reconfirmed_on bug_status Message-ID: In-Reply-To: References: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112882 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Last reconfirmed| |2023-12-06 Status|UNCONFIRMED |NEW --- Comment #1 from Jonathan Wakely --- (In reply to Tamar Christina from comment #0) > I know this is not a supported scenario, but I'm wondering if it's still > easy to support. >=20 > We have some libraries that use C++ mostly as an abstraction layer and try > to ensure that it needs no runtime support from libstdc++. >=20 > A recent commit: g:5e8a30d8b8f4d7ea0a8340b46c1e0c865dbde781 changed how > `__glibcxx_assert` is defined and now always calls > `std::__glibcxx_assert_fail`. >=20 > This means that now you always need libstdc++ even in contex where things > would have been folded away before. Similarly we're getting the same thi= ng > through usage of `std::unique_ptr`. Ugh, that's undesirable. It should only depend on that symbol when _GLIBCXX_ASSERTIONS is defined, but the change means we also use that symbol for constexpr checks. I'm surprised it doesn't get folded away though, since the code looks like: if (std::__is_constant_evaluated()) if (__builtin_expect(COND, false)) __glibcxx_assert_fail(...); Since __is_constant_evaluated is always false at runtime, that function can never be called. Either it's needed during compile-time and makes the progr= am ill-formed, or it's not needed at all. Ah, __is_constant_evaluated() is not marked always_inline, so at -O0 it just looks like a normal function call. > It seems that undefining `_GLIBCXX_VERBOSE_ASSERT` gets it to go to > `__builtin_abort()` which makes it work again. >=20 > If this change was intentional, would it be possible to make > `_GLIBCXX_VERBOSE_ASSERT` user configurable? You can use --disable-libstdcxx-verbose for that, or do you need to control= it during preprocessing?=