[Bug libstdc++/71856] _GLIBCXX_DEBUG-mode breaks GNU parallel extension

2016-07-13 Thread michael.hamann at kit dot edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71856

--- Comment #4 from Michael Hamann  ---
Created attachment 38889
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38889=edit
Test case, try compiling with g++ -D_GLIBCXX_DEBUG testcase.cpp

Sorry for not including a test case, I thought from the description and the
provided links the problem was clear enough but of course I should have known
better. I've attached a minimal test case.

[Bug libstdc++/71856] _GLIBCXX_DEBUG-mode breaks GNU parallel extension

2016-07-13 Thread michael.hamann at kit dot edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71856

--- Comment #2 from Michael Hamann  ---
This is not about activating parallel mode, this is about using individual
parallel algorithms by directly including e.g.  and using
the namespace __gnu_parallel explicitly. There I do not get the error you
mention. Is this not supported, too?

[Bug libstdc++/71856] New: _GLIBCXX_DEBUG-mode breaks GNU parallel extension

2016-07-13 Thread michael.hamann at kit dot edu
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).