public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/77744] Data race on std::regex_iterator using openmp
       [not found] <bug-77744-4@http.gcc.gnu.org/bugzilla/>
@ 2021-09-22  9:08 ` jakub at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: jakub at gcc dot gnu.org @ 2021-09-22  9:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77744

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #3)
> More importantly, the OpenMP version does not wait for the loop to finish
> (or at least, I see "#pragma omp for nowait" in the GIMPLE dump), so there
> is no happens-before relation between the loop body and the reTest
> destructor.

It does wait, the nowait there is just an optimization to avoid an unnecessary
extra barrier when there is one at the end of the parallel (the inital thread
doesn't continue until all other threads encountered the final barrier).

Current OpenMP (5.0+) allows lambdas, but we don't really know if there is any
race condition, as I said in #c5, tsan doesn't understand the libgomp barriers
and locking which are done using atomics and futexes, so in order to use
-fsanitize=thread together with libgomp the library needs to be built with
--disable-linux-futex, then it uses pthread_* APIs tsan understands.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-22  9:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-77744-4@http.gcc.gnu.org/bugzilla/>
2021-09-22  9:08 ` [Bug libstdc++/77744] Data race on std::regex_iterator using openmp jakub at gcc dot gnu.org

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