public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/40362]  New: openmp: some libgomp functions trigger data races
@ 2009-06-06 19:20 bart dot vanassche at gmail dot com
  2009-06-07  0:11 ` [Bug c++/40362] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: bart dot vanassche at gmail dot com @ 2009-06-06 19:20 UTC (permalink / raw)
  To: gcc-bugs

The source code of libgomp should be reviewed carefully whether all variables
that are accessed by more than one thread are protected by a consistent locking
strategy. When analyzing OpenMP programs with Helgrind or DRD, several data
races are reported. The test I ran myself and the results are as follows:
* Download Valgrind r10269 from the repository
svn://svn.valgrind.org/valgrind/trunk.
* Remove the libgomp suppression pattern from the file glibc-2.X-drd.supp.
* Build and install Valgrind.
* Recompile gcc 4.4.0 using the script drd/scripts/download-and-build-gcc
(which passes --disable-linux-futex to gcc's configure).
* Replace the distro-provided libgomp.so files by the freshly compiled ones.
* Check out the GraphicsMagick revision 2009-06-04 from CVS (see also
http://www.graphicsmagick.org/CVS.html for instructions).
* Run ./configure in the GraphicsMagick directory.
* Edit the drd: target in the generated Makefile and add the options
--check-stack-var=yes and --var-info=yes.
* Run the following command: export OMP_NUM_THREADS=4; make drd
* Inspect the files tests/*.log. A few extracts from these files:

>From drawtest.log:

==21970== Conflicting load by thread 3/3 at 0x07b411e8 size 8
==21970==    at 0x71A721F: gomp_work_share_start (ptrlock.h:42)
==21970==    by 0x71A466A: GOMP_loop_dynamic_start (loop.c:120)
==21970==    by 0x449AE7: PixelIterateMonoModify.omp_fn.3
(pixel_iterator.c:230)
==21970==    by 0x71A6977: gomp_thread_start (team.c:115)
==21970==    by 0x4C287BB: vgDrd_thread_wrapper (drd_pthread_intercepts.c:224)
==21970==    by 0x73B306F: start_thread (in /lib64/libpthread-2.9.so)
==21970==    by 0x769B10C: clone (in /lib64/libc-2.9.so)
==21970== Address 0x7b411e8 is at offset 376 from 0x7b41070. Allocation
context:
==21970==    at 0x4C249E9: malloc (vg_replace_malloc.c:193)
==21970==    by 0x71A2068: gomp_malloc (alloc.c:36)
==21970==    by 0x71A6FFC: gomp_new_team (team.c:143)
==21970==    by 0x71A5B2B: GOMP_parallel_start (parallel.c:108)
==21970==    by 0x449D71: PixelIterateMonoModify (pixel_iterator.c:230)
==21970==    by 0x431DAF: SetImage (image.c:4527)
==21970==    by 0x520198: ReadXCImage (xc.c:118)
==21970==    by 0x40B4FF: ReadImage (constitute.c:8478)
==21970==    by 0x40A006: main (drawtest.c:380)

==21970== Conflicting load by thread 3/3 at 0x07b41234 size 4
==21970==    at 0x71A35FD: gomp_iter_dynamic_next (iter.c:190)
==21970==    by 0x449AE7: PixelIterateMonoModify.omp_fn.3
(pixel_iterator.c:230)
==21970==    by 0x71A6977: gomp_thread_start (team.c:115)
==21970==    by 0x4C287BB: vgDrd_thread_wrapper (drd_pthread_intercepts.c:224)
==21970==    by 0x73B306F: start_thread (in /lib64/libpthread-2.9.so)
==21970==    by 0x769B10C: clone (in /lib64/libc-2.9.so)
==21970== Address 0x7b41234 is at offset 452 from 0x7b41070. Allocation
context:
==21970==    at 0x4C249E9: malloc (vg_replace_malloc.c:193)
==21970==    by 0x71A2068: gomp_malloc (alloc.c:36)
==21970==    by 0x71A6FFC: gomp_new_team (team.c:143)
==21970==    by 0x71A5B2B: GOMP_parallel_start (parallel.c:108)
==21970==    by 0x449D71: PixelIterateMonoModify (pixel_iterator.c:230)
==21970==    by 0x431DAF: SetImage (image.c:4527)
==21970==    by 0x520198: ReadXCImage (xc.c:118)
==21970==    by 0x40B4FF: ReadImage (constitute.c:8478)
==21970==    by 0x40A006: main (drawtest.c:380)

==21970== Conflicting load by thread 3/3 at 0x07b41240 size 8
==21970==    at 0x71A3601: gomp_iter_dynamic_next (iter.c:186)
==21970==    by 0x449AE7: PixelIterateMonoModify.omp_fn.3
(pixel_iterator.c:230)
==21970==    by 0x71A6977: gomp_thread_start (team.c:115)
==21970==    by 0x4C287BB: vgDrd_thread_wrapper (drd_pthread_intercepts.c:224)
==21970==    by 0x73B306F: start_thread (in /lib64/libpthread-2.9.so)
==21970==    by 0x769B10C: clone (in /lib64/libc-2.9.so)
==21970== Address 0x7b41240 is at offset 464 from 0x7b41070. Allocation
context:
==21970==    at 0x4C249E9: malloc (vg_replace_malloc.c:193)
==21970==    by 0x71A2068: gomp_malloc (alloc.c:36)
==21970==    by 0x71A6FFC: gomp_new_team (team.c:143)
==21970==    by 0x71A5B2B: GOMP_parallel_start (parallel.c:108)
==21970==    by 0x449D71: PixelIterateMonoModify (pixel_iterator.c:230)
==21970==    by 0x431DAF: SetImage (image.c:4527)
==21970==    by 0x520198: ReadXCImage (xc.c:118)
==21970==    by 0x40B4FF: ReadImage (constitute.c:8478)
==21970==    by 0x40A006: main (drawtest.c:380)

==21970== Conflicting load by thread 3/3 at 0x07b41248 size 8
==21970==    at 0x71A3605: gomp_iter_dynamic_next (iter.c:187)
==21970==    by 0x449AE7: PixelIterateMonoModify.omp_fn.3
(pixel_iterator.c:230)
==21970==    by 0x71A6977: gomp_thread_start (team.c:115)
==21970==    by 0x4C287BB: vgDrd_thread_wrapper (drd_pthread_intercepts.c:224)
==21970==    by 0x73B306F: start_thread (in /lib64/libpthread-2.9.so)
==21970==    by 0x769B10C: clone (in /lib64/libc-2.9.so)
==21970== Address 0x7b41248 is at offset 472 from 0x7b41070. Allocation
context:
==21970==    at 0x4C249E9: malloc (vg_replace_malloc.c:193)
==21970==    by 0x71A2068: gomp_malloc (alloc.c:36)
==21970==    by 0x71A6FFC: gomp_new_team (team.c:143)
==21970==    by 0x71A5B2B: GOMP_parallel_start (parallel.c:108)
==21970==    by 0x449D71: PixelIterateMonoModify (pixel_iterator.c:230)
==21970==    by 0x431DAF: SetImage (image.c:4527)
==21970==    by 0x520198: ReadXCImage (xc.c:118)
==21970==    by 0x40B4FF: ReadImage (constitute.c:8478)
==21970==    by 0x40A006: main (drawtest.c:380)

==21970== Conflicting load by thread 3/3 at 0x07b412a0 size 8
==21970==    at 0x71A3614: gomp_iter_dynamic_next (iter.c:192)
==21970==    by 0x449AE7: PixelIterateMonoModify.omp_fn.3
(pixel_iterator.c:230)
==21970==    by 0x71A6977: gomp_thread_start (team.c:115)
==21970==    by 0x4C287BB: vgDrd_thread_wrapper (drd_pthread_intercepts.c:224)
==21970==    by 0x73B306F: start_thread (in /lib64/libpthread-2.9.so)
==21970==    by 0x769B10C: clone (in /lib64/libc-2.9.so)
==21970== Address 0x7b412a0 is at offset 560 from 0x7b41070. Allocation
context:
==21970==    at 0x4C249E9: malloc (vg_replace_malloc.c:193)
==21970==    by 0x71A2068: gomp_malloc (alloc.c:36)
==21970==    by 0x71A6FFC: gomp_new_team (team.c:143)
==21970==    by 0x71A5B2B: GOMP_parallel_start (parallel.c:108)
==21970==    by 0x449D71: PixelIterateMonoModify (pixel_iterator.c:230)
==21970==    by 0x431DAF: SetImage (image.c:4527)
==21970==    by 0x520198: ReadXCImage (xc.c:118)
==21970==    by 0x40B4FF: ReadImage (constitute.c:8478)
==21970==    by 0x40A006: main (drawtest.c:380)


-- 
           Summary: openmp: some libgomp functions trigger data races
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bart dot vanassche at gmail dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40362


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

end of thread, other threads:[~2009-06-13 16:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-06 19:20 [Bug c++/40362] New: openmp: some libgomp functions trigger data races bart dot vanassche at gmail dot com
2009-06-07  0:11 ` [Bug c++/40362] " pinskia at gcc dot gnu dot org
2009-06-07  6:15 ` bart dot vanassche at gmail dot com
2009-06-07  6:23 ` pinskia at gcc dot gnu dot org
2009-06-07  6:52 ` bart dot vanassche at gmail dot com
2009-06-07  6:58 ` pinskia at gcc dot gnu dot org
2009-06-07  7:09 ` bart dot vanassche at gmail dot com
2009-06-07 13:07 ` jakub at gcc dot gnu dot org
2009-06-08 18:30 ` bart dot vanassche at gmail dot com
2009-06-13 16:23 ` bart dot vanassche at gmail dot com

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