public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/112808] New: Consider enabling _GLIBCXX_ASSERTIONS checks by default for debug builds
@ 2023-12-01 10:35 helge at penne dot no
  2023-12-01 15:10 ` [Bug libstdc++/112808] " redi at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: helge at penne dot no @ 2023-12-01 10:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112808

            Bug ID: 112808
           Summary: Consider enabling _GLIBCXX_ASSERTIONS checks by
                    default for debug builds
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: helge at penne dot no
  Target Milestone: ---

In my experience, the assertions enabled by _GLIBCXX_ASSERTIONS are incredidbly
important and effective, but sadly nowhere near as well known or widely used as
they deserve to be.

Lately, C++ has been attracting negative attention for security, and using
_GLIBCXX_ASSERTIONS is probably one of the most efficient and easy ways to
improve things in the short term.

Should the checks enabled by _GLIBCXX_ASSERTIONS enabled by default in debug
builds (somewhat like with NDEBUG and the assert macro), effectlively making
them "opt-out" instead of "opt-in"?  This will allow a lot of latent security
bugs to be detected before software is put into production.

This will have a performance hit on unoptimized builds, but my experience so
far is that the performance hit on optimized builds is small because the
optimizer is very often able to figure out that the checks are redundant, and
will remove them.

I think making these checks enabled by default in debug builds will have huge
positive impact on the security of C++ code bases, at an acceptable cost.  It
also sends a message that the language add tools is evolving in a more secure
direction.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libstdc++/112808] Consider enabling _GLIBCXX_ASSERTIONS checks by default for debug builds
  2023-12-01 10:35 [Bug libstdc++/112808] New: Consider enabling _GLIBCXX_ASSERTIONS checks by default for debug builds helge at penne dot no
@ 2023-12-01 15:10 ` redi at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2023-12-01 15:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112808

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-12-01
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yes I've been considering making them opt out for a while (maybe even in
optimized builds).


The libstdc++ config can use #ifndef __OPTIMIZE__ to detect when building
without optimization.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-01 15:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-01 10:35 [Bug libstdc++/112808] New: Consider enabling _GLIBCXX_ASSERTIONS checks by default for debug builds helge at penne dot no
2023-12-01 15:10 ` [Bug libstdc++/112808] " redi at gcc dot gnu.org

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).