Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Nov 2022 19:08:45 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 267768] Simple OpenMP example with thread sanitizer (-fsanitize=thread)
Message-ID:  <bug-267768-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D267768

            Bug ID: 267768
           Summary: Simple OpenMP example with thread sanitizer
                    (-fsanitize=3Dthread)
           Product: Base System
           Version: 13.1-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: yuri@freebsd.org
 Attachment #238078 text/plain
         mime type:

Created attachment 238078
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D238078&action=
=3Dedit
openmp.cpp

The attached code crashes when compiler like this:
> c++ openmp.cpp -fsanitize=3Dthread -g -fopenmp

The executable SEDVs.
But in debugger it prints this:
(gdb) r
Starting program: /usr/home/yuri/Downloads/a.out=20
Warning: please export TSAN_OPTIONS=3D'ignore_noninstrumented_modules=3D1' =
to avoid
false positive reports from the OpenMP runtime!
[New LWP 464093 of process 56986]
[New LWP 464094 of process 56986]
[New LWP 464095 of process 56986]
[New LWP 464096 of process 56986]
[Detaching after fork from child process 56987]
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
WARNING: ThreadSanitizer: data race (pid=3D56986)
  Atomic read of size 1 at 0x7b6800001740 by main thread:
    #0 pthread_mutex_lock
/disk-samsung/freebsd-src/contrib/llvm-project/compiler-rt/lib/sanitizer_co=
mmon/sanitizer_common_interceptors.inc:4324:3
(a.out+0x27a256)
    #1 __kmp_lock_suspend_mx
/disk-samsung/freebsd-src/contrib/llvm-project/openmp/runtime/src/z_Linux_u=
til.cpp:1381:16
(libomp.so+0xcd206)
    #2 void __kmp_resume_template<kmp_flag_64<false, true> >(int,
kmp_flag_64<false, true>*)
/disk-samsung/freebsd-src/contrib/llvm-project/openmp/runtime/src/z_Linux_u=
til.cpp:1594:3
(libomp.so+0xcd206)

  Previous write of size 1 at 0x7b6800001740 by thread T2:
    #0 _pthread_mutex_init
/disk-samsung/freebsd-src/contrib/llvm-project/compiler-rt/lib/tsan/rtl/tsa=
n_interceptors_posix.cpp:1316:3
(a.out+0x2655eb)
    #1 __kmp_suspend_initialize_thread
/disk-samsung/freebsd-src/contrib/llvm-project/openmp/runtime/src/z_Linux_u=
til.cpp:1348:14
(libomp.so+0xcbc27)

  Location is heap block of size 1504 at 0x7b6800001200 allocated by main
thread:
    #0 malloc
/disk-samsung/freebsd-src/contrib/llvm-project/compiler-rt/lib/tsan/rtl/tsa=
n_interceptors_posix.cpp:667:5
(a.out+0x262e8e)
    #1 ___kmp_allocate_align(unsigned long, unsigned long)
/disk-samsung/freebsd-src/contrib/llvm-project/openmp/runtime/src/kmp_alloc=
.cpp:1882:25
(libomp.so+0x54d3c)
    #2 ___kmp_allocate
/disk-samsung/freebsd-src/contrib/llvm-project/openmp/runtime/src/kmp_alloc=
.cpp:1934:9
(libomp.so+0x54d3c)

  Thread T2 (tid=3D464095, running) created by main thread at:
    #0 pthread_create
/disk-samsung/freebsd-src/contrib/llvm-project/compiler-rt/lib/tsan/rtl/tsa=
n_interceptors_posix.cpp:1022:3
(a.out+0x264435)
    #1 __kmp_create_worker
/disk-samsung/freebsd-src/contrib/llvm-project/openmp/runtime/src/z_Linux_u=
til.cpp:803:7
(libomp.so+0xca8d8)

SUMMARY: ThreadSanitizer: data race
/disk-samsung/freebsd-src/contrib/llvm-project/openmp/runtime/src/z_Linux_u=
til.cpp:1381:16
in __kmp_lock_suspend_mx
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
[LWP 464095 of process 56986 exited]
[LWP 464094 of process 56986 exited]
[LWP 464096 of process 56986 exited]
ThreadSanitizer: reported 1 warnings
[LWP 464093 of process 56986 exited]
[Inferior 1 (process 56986) exited with code 0102]

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-267768-227>