https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71856
Bug ID: 71856
Summary: _GLIBCXX_DEBUG-mode breaks GNU parallel extension
Product: gcc
Version: 6.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: michael.hamann at kit dot edu
Target Milestone: ---
When _GLIBCXX_DEBUG is defined, the recently introduced macro
_GLIBCXX_ASSERTIONS (see #56109) is defined as empty (see
https://github.com/gcc-mirror/gcc/blob/55174bb97660bbd9c27262bc48b6da88a1b4a18f/libstdc%2B%2B-v3/include/bits/c%2B%2Bconfig#L415).
Unfortunately, the new macro (_GLIBCXX_ASSERTIONS) was already in use in the
GNU parallel extension where it is always defined (see
https://github.com/gcc-mirror/gcc/blob/edd716b6b1caa1a5cb320a8cd7f626f30198e098/libstdc%2B%2B-v3/include/parallel/compiletime_settings.h#L58).
There almost all checks for it use a simple #if (without "defined"), see e.g.
https://github.com/gcc-mirror/gcc/blob/edd716b6b1caa1a5cb320a8cd7f626f30198e098/libstdc%2B%2B-v3/include/parallel/balanced_quicksort.h#L54.
When enabling _GLIBCXX_DEBUG, _GLIBCXX_ASSERTIONS is defined as empty, which
makes it impossible to compile code that uses the GNU parallel extension
(error: #if with no expression).
Further, the define of _GLIBCXX_ASSERTIONS to 0 in the GNU parallel extension
might enable assertions in other parts of the standard library unintentionally.
I encountered the bug in GCC 6.1.1, but the affected code seems to be unchanged
in the current trunk version (all code links point to the trunk version).