Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Oct 2025 06:37:43 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 290687] LIBCPP hardening asserts are enabled with -DNDEBUG which degrades performance
Message-ID:  <bug-290687-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=290687

            Bug ID: 290687
           Summary: LIBCPP hardening asserts are enabled with -DNDEBUG
                    which degrades performance
           Product: Base System
           Version: 14.3-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: yuri@freebsd.org

---BEGIN test program---
//#define _LIBCPP_HARDENING_MODE _LIBCPP_HARDENING_MODE_NONE 

#include <vector>
#include <iostream>


int main() {
        std::vector<int> v = {1, 2, 3, 4, 5};

        std::cout << "last-ptr=" << &v[5] << std::endl;

        return 0;
}
---END test program---

The above program fails with Illegal instruction due to LIBCPP asserts being
enabled.

Normally all asserts should be disabled with -DNDEBUG but these LIBCPP asserts
remain.

The hardening mode can be changed by uncommenting the first line in the
program.

_LIBCPP_HARDENING_MODE should probably default to _LIBCPP_HARDENING_MODE_NONE
with -DNDEBUG.

-- 
You are receiving this mail because:
You are the assignee for the bug.

help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-290687-227>