public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/66553] New: openmp tasks produce libgomp warnings with fsanitize=thread
@ 2015-06-16 12:07 jtaylor.debian at googlemail dot com
2015-06-16 12:25 ` [Bug libgomp/66553] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: jtaylor.debian at googlemail dot com @ 2015-06-16 12:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66553
Bug ID: 66553
Summary: openmp tasks produce libgomp warnings with
fsanitize=thread
Product: gcc
Version: 5.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libgomp
Assignee: unassigned at gcc dot gnu.org
Reporter: jtaylor.debian at googlemail dot com
CC: jakub at gcc dot gnu.org
Target Milestone: ---
when libgomp has been built with -fsanitize=thread works very well on programs
that do not use openmp tasks (just sections, parallel for etc.). There are no
false positives inside libgomp and it still nicely finds races in my code.
Unfortunately when using openmp tasks one gets warnings from libgomp itself
that (assuming they are only false positives) make it harder to find bugs in
the code one wants to instrument.
E.g. this simple example:
#include <stdio.h>
#include <omp.h>
int f(int i)
{
printf("%d %d\n", omp_get_thread_num(), i);
return i;
}
int main(int argc, const char *argv[])
{
#pragma omp parallel
#pragma omp single
{
for (size_t i = 0; i < 2; i++) {
#pragma omp task
f(i);
}
}
return 0;
}
when compiled with
$ gcc --version
gcc (GCC) 5.1.0
$ gcc tasks.c -fopenmp -fsanitize=thread
and run with a libgomp also compiled with sanitation, produces following
warning:
WARNING: ThreadSanitizer: data race (pid=11034)
Write of size 4 at 0x7d6c0001f184 by main thread:
#0 gomp_team_barrier_set_task_pending ../libgomp/config/linux/bar.h:135
(libgomp.so.1+0x000000013ad1)
#1 GOMP_task ../libgomp/task.c:406 (libgomp.so.1+0x000000013ad1)
#2 main._omp_fn.0 <null> (a.out+0x000000400b09)
#3 GOMP_parallel ../libgomp/parallel.c:168 (libgomp.so.1+0x0000000101cc)
#4 main <null> (a.out+0x000000400a80)
Previous atomic read of size 4 at 0x7d6c0001f184 by thread T1:
#0 __tsan_atomic32_load
../../../../libsanitizer/tsan/tsan_interface_atomic.cc:530
(libtsan.so.0+0x0000000591bc)
#1 gomp_barrier_wait_final_start ../libgomp/config/linux/bar.h:115
(libgomp.so.1+0x00000001b558)
#2 gomp_team_barrier_wait_final ../libgomp/config/linux/bar.c:133
(libgomp.so.1+0x00000001b558)
#3 gomp_thread_start ../libgomp/team.c:119 (libgomp.so.1+0x000000016d14)
Location is heap block of size 1712 at 0x7d6c0001f100 allocated by main
thread:
#0 malloc ../../../../libsanitizer/tsan/tsan_interceptors.cc:491
(libtsan.so.0+0x0000000280d3)
#1 gomp_malloc ../libgomp/alloc.c:37 (libgomp.so.1+0x00000000a11a)
#2 gomp_new_team ../libgomp/team.c:149 (libgomp.so.1+0x000000016d6a)
#3 GOMP_parallel ../libgomp/parallel.c:167 (libgomp.so.1+0x0000000101b3)
#4 main <null> (a.out+0x000000400a80)
Thread T1 (tid=11036, running) created by main thread at:
#0 pthread_create ../../../../libsanitizer/tsan/tsan_interceptors.cc:895
(libtsan.so.0+0x000000029cc4)
#1 gomp_team_start ../libgomp/team.c:796 (libgomp.so.1+0x00000001754e)
#2 GOMP_parallel ../libgomp/parallel.c:167 (libgomp.so.1+0x0000000101c7)
#3 main <null> (a.out+0x000000400a80)
SUMMARY: ThreadSanitizer: data race ../libgomp/config/linux/bar.h:135
gomp_team_barrier_set_task_pending
libgomp was built like this:
make CPPFLAGS='-fsanitize=thread' LDFLAGS='-fsanitize=thread' CC=gcc
Equivalent code not using tasks does not produce any warnings.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libgomp/66553] openmp tasks produce libgomp warnings with fsanitize=thread
2015-06-16 12:07 [Bug libgomp/66553] New: openmp tasks produce libgomp warnings with fsanitize=thread jtaylor.debian at googlemail dot com
@ 2015-06-16 12:25 ` pinskia at gcc dot gnu.org
2015-06-17 15:44 ` jtaylor.debian at googlemail dot com
2024-02-29 17:48 ` egallager at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-06-16 12:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66553
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is a false error really.
Because There is a mutex lock around the code that does any of the stores.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libgomp/66553] openmp tasks produce libgomp warnings with fsanitize=thread
2015-06-16 12:07 [Bug libgomp/66553] New: openmp tasks produce libgomp warnings with fsanitize=thread jtaylor.debian at googlemail dot com
2015-06-16 12:25 ` [Bug libgomp/66553] " pinskia at gcc dot gnu.org
@ 2015-06-17 15:44 ` jtaylor.debian at googlemail dot com
2024-02-29 17:48 ` egallager at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: jtaylor.debian at googlemail dot com @ 2015-06-17 15:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66553
--- Comment #2 from Julian Taylor <jtaylor.debian at googlemail dot com> ---
if it is a false positive, is there a way to silence it too make the thread
sanitize more useful with openmp task using programs?
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libgomp/66553] openmp tasks produce libgomp warnings with fsanitize=thread
2015-06-16 12:07 [Bug libgomp/66553] New: openmp tasks produce libgomp warnings with fsanitize=thread jtaylor.debian at googlemail dot com
2015-06-16 12:25 ` [Bug libgomp/66553] " pinskia at gcc dot gnu.org
2015-06-17 15:44 ` jtaylor.debian at googlemail dot com
@ 2024-02-29 17:48 ` egallager at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: egallager at gcc dot gnu.org @ 2024-02-29 17:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66553
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |egallager at gcc dot gnu.org
--- Comment #4 from Eric Gallager <egallager at gcc dot gnu.org> ---
dup of, or at least related to, bug 55561?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-29 17:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-16 12:07 [Bug libgomp/66553] New: openmp tasks produce libgomp warnings with fsanitize=thread jtaylor.debian at googlemail dot com
2015-06-16 12:25 ` [Bug libgomp/66553] " pinskia at gcc dot gnu.org
2015-06-17 15:44 ` jtaylor.debian at googlemail dot com
2024-02-29 17:48 ` egallager 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).