https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112882
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This minimal fix is enough to remove the reference to __glibcxx_assert_fail
when optimization is enabled (at any level):
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -598,7 +598,7 @@ namespace std
# define __glibcxx_assert(cond)
\
do { \
- if _GLIBCXX17_CONSTEXPR (_GLIBCXX_DO_ASSERT) \
+ if (_GLIBCXX_DO_ASSERT) \
if (__builtin_expect(!bool(cond), false))
\
_GLIBCXX_ASSERT_FAIL(cond); \
} while (false)
But we still need the more complete fix for -O0.