public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pilarlatiesa at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/113376] New: Confusing notes when using C++17 parallel algorithms
Date: Sat, 13 Jan 2024 13:04:48 +0000	[thread overview]
Message-ID: <bug-113376-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2024-01-13 13:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-13 13:04 pilarlatiesa at gmail dot com [this message]
2024-01-13 14:26 ` [Bug libstdc++/113376] " redi at gcc dot gnu.org
2024-01-15  8:50 ` pilarlatiesa at gmail dot com
2024-01-15 10:17 ` redi at gcc dot gnu.org
2024-01-15 15:13 ` pilarlatiesa at gmail dot com
2024-01-15 16:05 ` redi at gcc dot gnu.org
2024-06-12 10:48 ` redi at gcc dot gnu.org
2024-06-12 10:56 ` redi at gcc dot gnu.org
2024-06-12 11:22 ` [Bug libstdc++/113376] [14/15 Regression] " redi at gcc dot gnu.org
2024-06-12 20:40 ` redi at gcc dot gnu.org
2024-06-13 13:10 ` cvs-commit at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-113376-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).