This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/40362] New: openmp: some libgomp functions trigger data races


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]