[Bug 279443] LIBCPP assertions are enabled in optimized builds when -DNDEBUG is given to clang

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 01 Jun 2024 03:21:17 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279443

--- Comment #6 from Mark Millard <marklmi26-fbsd@yahoo.com> ---
(In reply to Mark Millard from comment #5)

Testing -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE for the
code having:

            std::copy(
                &buf[0],
                &buf[cb], // !!! ASSERTs HERE !!!
                //&buf[0] + cb,
                std::back_inserter(r)
            );

# c++ -g -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE
get_executable_filename.cpp
# gdb a.out
. . .
Reading symbols from a.out...
(gdb) run
Starting program: /usr/home/root/c_tests/a.out 
/usr/home/root/c_tests/a.out
[Inferior 1 (process 66950) exited normally]

In a more general context you might need both -DNDEBUG for the non-libc++ code
and
also the -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE for the libc++
code that is involved for one compile command.

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