[llvm-bugs] [Bug 43363] New: Segfault/Assertion failure in ___kmp_fast_free

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 19 13:47:48 PDT 2019


            Bug ID: 43363
           Summary: Segfault/Assertion failure in ___kmp_fast_free
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Runtime Library
          Assignee: unassignedbugs at nondot.org
          Reporter: lennart.braun at posteo.de
                CC: llvm-bugs at lists.llvm.org

Created attachment 22530
  --> https://bugs.llvm.org/attachment.cgi?id=22530&action=edit
reproducer and asan/gdb traces

Hi everyone,

I ran into an issue which causes crashes of our application when compiled with
Clang and libomp (8.0.1 each).  I was able to reproduce it with version
9.0.0rc6 of libomp compiled with debug symbols and ASan.

Most of the time, ASan reports a SEGV caused by a READ operation in
___kmp_fast_free (according to GDB at kmp_alloc.cpp:1956, according to ASan in

Sometimes one of the following assertions fails:


To reproduce the crash I have attached some example code (crash_omp.cpp) which
is based on one of our test cases.  I tried to strip all unnecessary code and
make the example as small as possible.  Hence, the code itself probably does
not make much sense anymore.  On my machine the crash appears usually in
iteration 4 of the loop in the main function.  Compile it as:

$ clang++ -o crash_omp -std=c++17 -fopenmp=libomp -g -fsanitize=address

I run Arch Linux on x86_64 and used the following versions of libomp and Clang:

libomp 9.0.0-rc6 (from
compiled with:

  cmake .. -G Ninja \
    -DCMAKE_C_FLAGS=-fsanitize=address \

$ clang++ --version
clang version 8.0.1 (tags/RELEASE_801/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

* crash_omp.cpp
* asan_output.txt
* gdb_stacktrace.txt

Please let me know if you need more information.




While debugging I noticed that

#pragma omp taskloop num_tasks(n) default(shared)

with n == 0 causes libomp to perform a division by 0 which results in a crash
with SIGFPE.  I don't know if this behavior is intended or an error message is
preferred here.  (The spec requires n to be positive

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190919/bbd8d2de/attachment.html>

More information about the llvm-bugs mailing list