https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113376
Bug ID: 113376
Summary: Confusing notes when using C++17 parallel algorithms
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: pilarlatiesa at gmail dot com
Target Milestone: ---
With GCC 14, the following code:
#include <algorithm>
#include <execution>
#include <vector>
void f(std::vector<int> &v)
{
std::for_each(std::execution::par, v.begin(), v.end(),
[](int &i) { i *= 2; });
}
when compiled emits a lot of notes like:
/home/pililatiesa/gcc-14/include/c++/14.0.0/pstl/algorithm_impl.h: In function
'_RandomAccessIterator
__pstl::__internal::__brick_unique(_RandomAccessIterator,
_RandomAccessIterator, _BinaryPredicate, std::true_type)':
/home/pililatiesa/gcc-14/include/c++/14.0.0/pstl/algorithm_impl.h:1219:5: note:
'#pragma message: [Parallel STL message]: "Vectorized algorithm unimplemented,
redirected to serial"'
1219 | _PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented,
redirected to serial");
| ^~~~~~~~~~~~~~~~~~~~
I don't understand why all these functions are even instantiated as they appear
to be related to the vectorization of other algorithms.
Furthermore, in pstl_config.h we have:
// Check the user-defined macro for warnings
#if defined(PSTL_USAGE_WARNINGS)
# undef _PSTL_USAGE_WARNINGS
# define _PSTL_USAGE_WARNINGS PSTL_USAGE_WARNINGS
// Check the internal macro for warnings
#elif !defined(_PSTL_USAGE_WARNINGS)
# define _PSTL_USAGE_WARNINGS 0
#endif
and later in this file:
#if defined(_PSTL_USAGE_WARNINGS)
# define _PSTL_PRAGMA_MESSAGE(x) _PSTL_PRAGMA_MESSAGE_IMPL(x)
# define _PSTL_PRAGMA_MESSAGE_POLICIES(x) _PSTL_PRAGMA_MESSAGE_IMPL(x)
#else
# define _PSTL_PRAGMA_MESSAGE(x)
# define _PSTL_PRAGMA_MESSAGE_POLICIES(x)
#endif
i.e. is checking defined(_PSTL_USAGE_WARNINGS) instead of just
_PSTL_USAGE_WARNINGS. This logic doesn't seem right.