public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* Fwd: [Bug libstdc++/90276] PSTL tests fail in Debug Mode
       [not found] <6f4934ac-4a71-48df-8146-f11a0db9df37@gmail.com>
@ 2024-01-31 18:17 ` François Dumont
  2024-01-31 23:33   ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: François Dumont @ 2024-01-31 18:17 UTC (permalink / raw)
  To: libstdc++; +Cc: gcc-patches


[-- Attachment #1.1: Type: text/plain, Size: 1514 bytes --]

I replied to bugzilla rather than sending to proper mailing list !

At the same time it looks like you also found the root cause of the 
problem Jonathan. Just let me know if you want to deal with it eventually.

François


-------- Forwarded Message --------
Subject: 	Re: [Bug libstdc++/90276] PSTL tests fail in Debug Mode
Date: 	Wed, 31 Jan 2024 19:09:02 +0100
From: 	François Dumont <frs.dumont@gmail.com>
To: 	redi at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>, 
fdumont@gcc.gnu.org



Here is the reason of the 
20_util/specialized_algorithms/pstl/uninitialized_copy_move.cc FAIL.

Maybe it fixes some other tests too, I need to run all of them.

     libstdc++: Do not forward arguments several times [PR90276]

     Forwarding several times the same arguments results in UB. It is 
detected
     by the _GLIBCXX_DEBUG mode as an attempt to use a singular iterator 
which has
     been moved.

     libstdc++-v3/ChangeLog

             PR libstdc++/90276
             * testsuite/util/pstl/test_utils.h: Remove std::forward<> 
calls when
             done several times on the same arguments.

Ok to commit ?

François


On 31/01/2024 14:11, redi at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90276
>
> Jonathan Wakely <redi at gcc dot gnu.org> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> See Also| |https://github.com/llvm/llv
> | |m-project/issues/80136
>

[-- Attachment #2: pstl_test_utils.h.patch --]
[-- Type: text/x-patch, Size: 2216 bytes --]

diff --git a/libstdc++-v3/testsuite/util/pstl/test_utils.h b/libstdc++-v3/testsuite/util/pstl/test_utils.h
index ed6d48b9471..fc3de6ae24b 100644
--- a/libstdc++-v3/testsuite/util/pstl/test_utils.h
+++ b/libstdc++-v3/testsuite/util/pstl/test_utils.h
@@ -1088,13 +1088,14 @@ struct reverse_invoker
     operator()(Rest&&... rest)
     {
         // Random-access iterator
-        iterator_invoker<std::random_access_iterator_tag, IsReverse>()(std::forward<Rest>(rest)...);
+        iterator_invoker<std::random_access_iterator_tag, IsReverse>()(rest...);
 
         // Forward iterator
-        iterator_invoker<std::forward_iterator_tag, IsReverse>()(std::forward<Rest>(rest)...);
+
+        iterator_invoker<std::forward_iterator_tag, IsReverse>()(rest...);
 
         // Bidirectional iterator
-        iterator_invoker<std::bidirectional_iterator_tag, IsReverse>()(std::forward<Rest>(rest)...);
+        iterator_invoker<std::bidirectional_iterator_tag, IsReverse>()(rest...);
     }
 };
 
@@ -1104,8 +1105,8 @@ struct invoke_on_all_iterator_types
     void
     operator()(Rest&&... rest)
     {
-        reverse_invoker</* IsReverse = */ std::false_type>()(std::forward<Rest>(rest)...);
-        reverse_invoker</* IsReverse = */ std::true_type>()(std::forward<Rest>(rest)...);
+        reverse_invoker</* IsReverse = */ std::false_type>()(rest...);
+        reverse_invoker</* IsReverse = */ std::true_type>()(rest...);
     }
 };
 //============================================================================
@@ -1118,10 +1119,10 @@ invoke_on_all_policies(Op op, T&&... rest)
     using namespace __pstl::execution;
 
     // Try static execution policies
-    invoke_on_all_iterator_types()(seq, op, std::forward<T>(rest)...);
-    invoke_on_all_iterator_types()(unseq, op, std::forward<T>(rest)...);
-    invoke_on_all_iterator_types()(par, op, std::forward<T>(rest)...);
-    invoke_on_all_iterator_types()(par_unseq, op, std::forward<T>(rest)...);
+    invoke_on_all_iterator_types()(seq, op, rest...);
+    invoke_on_all_iterator_types()(unseq, op, rest...);
+    invoke_on_all_iterator_types()(par, op, rest...);
+    invoke_on_all_iterator_types()(par_unseq, op, rest...);
 }
 
 template <typename F>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Bug libstdc++/90276] PSTL tests fail in Debug Mode
  2024-01-31 18:17 ` Fwd: [Bug libstdc++/90276] PSTL tests fail in Debug Mode François Dumont
@ 2024-01-31 23:33   ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2024-01-31 23:33 UTC (permalink / raw)
  To: François Dumont; +Cc: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1738 bytes --]

On Wed, 31 Jan 2024 at 18:18, François Dumont <frs.dumont@gmail.com> wrote:

> I replied to bugzilla rather than sending to proper mailing list !
>
> At the same time it looks like you also found the root cause of the
> problem Jonathan. Just let me know if you want to deal with it eventually.
>

I'll take care of it, thanks.


> François
>
> -------- Forwarded Message --------
> Subject: Re: [Bug libstdc++/90276] PSTL tests fail in Debug Mode
> Date: Wed, 31 Jan 2024 19:09:02 +0100
> From: François Dumont <frs.dumont@gmail.com> <frs.dumont@gmail.com>
> To: redi at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>
> <gcc-bugzilla@gcc.gnu.org>, fdumont@gcc.gnu.org
>
> Here is the reason of the
> 20_util/specialized_algorithms/pstl/uninitialized_copy_move.cc FAIL.
>
> Maybe it fixes some other tests too, I need to run all of them.
>
>     libstdc++: Do not forward arguments several times [PR90276]
>
>     Forwarding several times the same arguments results in UB. It is
> detected
>     by the _GLIBCXX_DEBUG mode as an attempt to use a singular iterator
> which has
>     been moved.
>
>     libstdc++-v3/ChangeLog
>
>             PR libstdc++/90276
>             * testsuite/util/pstl/test_utils.h: Remove std::forward<>
> calls when
>             done several times on the same arguments.
>
> Ok to commit ?
>
> François
>
>
> On 31/01/2024 14:11, redi at gcc dot gnu.org wrote:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90276
>
> Jonathan Wakely <redi at gcc dot gnu.org> changed:
>
> What |Removed |Added
>
> ----------------------------------------------------------------------------
> See Also| |https://github.com/llvm/llv
> | |m-project/issues/80136
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-31 23:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <6f4934ac-4a71-48df-8146-f11a0db9df37@gmail.com>
2024-01-31 18:17 ` Fwd: [Bug libstdc++/90276] PSTL tests fail in Debug Mode François Dumont
2024-01-31 23:33   ` Jonathan Wakely

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).