GCC modified for the FreeChainXenon project
![]() This makes constexpr std::vector (mostly) work in Debug Mode. All safe iterator instrumentation and checking is disabled during constant evaluation, because it requires mutex locks and calls to non-inline functions defined in libstdc++.so. It should be OK to disable the safety checks, because most UB should be detected during constant evaluation anyway. We could try to enable the full checking in constexpr, but it would mean wrapping all the non-inline functions like _M_attach with an inline _M_constexpr_attach that does the iterator housekeeping inline without mutex locks when called for constant evaluation, and calls the non-inline function at runtime. That could be done in future if we find that we've lost safety or useful checking by disabling the safe iterators. There are a few test failures in C++20 mode, which I'm unable to explain. The _Safe_iterator::operator++() member gives errors for using non-constexpr functions during constant evaluation, even though those functions are guarded by std::is_constant_evaluated() checks. The same code works fine for C++23 and up. libstdc++-v3/ChangeLog: PR libstdc++/109536 * include/bits/c++config (__glibcxx_constexpr_assert): Remove macro. * include/bits/stl_algobase.h (__niter_base, __copy_move_a) (__copy_move_backward_a, __fill_a, __fill_n_a, __equal_aux) (__lexicographical_compare_aux): Add constexpr to overloads for debug mode iterators. * include/debug/helper_functions.h (__unsafe): Add constexpr. * include/debug/macros.h (_GLIBCXX_DEBUG_VERIFY_COND_AT): Remove macro, folding it into ... (_GLIBCXX_DEBUG_VERIFY_AT_F): ... here. Do not use __glibcxx_constexpr_assert. * include/debug/safe_base.h (_Safe_iterator_base): Add constexpr to some member functions. Omit attaching, detaching and checking operations during constant evaluation. * include/debug/safe_container.h (_Safe_container): Likewise. * include/debug/safe_iterator.h (_Safe_iterator): Likewise. * include/debug/safe_iterator.tcc (__niter_base, __copy_move_a) (__copy_move_backward_a, __fill_a, __fill_n_a, __equal_aux) (__lexicographical_compare_aux): Add constexpr. * include/debug/vector (_Safe_vector, vector): Add constexpr. Omit safe iterator operations during constant evaluation. * testsuite/23_containers/vector/bool/capacity/constexpr.cc: Remove dg-xfail-if for debug mode. * testsuite/23_containers/vector/bool/cmp_c++20.cc: Likewise. * testsuite/23_containers/vector/bool/cons/constexpr.cc: Likewise. * testsuite/23_containers/vector/bool/element_access/1.cc: Likewise. * testsuite/23_containers/vector/bool/element_access/constexpr.cc: Likewise. * testsuite/23_containers/vector/bool/modifiers/assign/constexpr.cc: Likewise. * testsuite/23_containers/vector/bool/modifiers/constexpr.cc: Likewise. * testsuite/23_containers/vector/bool/modifiers/swap/constexpr.cc: Likewise. * testsuite/23_containers/vector/capacity/constexpr.cc: Likewise. * testsuite/23_containers/vector/cmp_c++20.cc: Likewise. * testsuite/23_containers/vector/cons/constexpr.cc: Likewise. * testsuite/23_containers/vector/data_access/constexpr.cc: Likewise. * testsuite/23_containers/vector/element_access/constexpr.cc: Likewise. * testsuite/23_containers/vector/modifiers/assign/constexpr.cc: Likewise. * testsuite/23_containers/vector/modifiers/constexpr.cc: Likewise. * testsuite/23_containers/vector/modifiers/swap/constexpr.cc: Likewise. * testsuite/23_containers/vector/cons/destructible_debug_neg.cc: Adjust dg-error line number. |
||
---|---|---|
.github | ||
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgm2 | ||
libgo | ||
libgomp | ||
libgrust | ||
libiberty | ||
libitm | ||
libobjc | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
COPYING3 | ||
COPYING3.LIB | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
lt~obsolete.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
README | ||
SECURITY.txt | ||
symlink-tree | ||
test-driver | ||
ylwrap |
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.