<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - calling omp_unset_lock() on lock never set, or already unset drops core"
   href="https://bugs.llvm.org/show_bug.cgi?id=41453">41453</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>calling omp_unset_lock() on lock never set, or already unset drops core
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>OpenMP
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Runtime Library
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>itzkowitzmarty@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>It gives core dump within the runtime
    __kmp_release_queuing_lock(0x0, 0xffffffff00000000, 0x0, 0x0, 0x1, 0x0), at
0x7fb7121e3278
using the libomp.so that was built with spack install llvm-develop,
and compiled with gcc.

It gives an assertion failure with the libomp.so that is currently under
development for OMPT support.

I suspect the core dump is independent of the compiler.

Program to reproduce and Makefile below.
-----------------------------------------------------------
// lockbug -- reproduce assertion failure in libomp.so, when user
//      calls omp_unset_lock on a lock that was never set.
//      It also will fail on a duplicate free

#include <omp.h>

int main(int argc, char **argv)
{
        omp_lock_t      lock1;
        omp_set_num_threads(4);

        // initialize the lock
        omp_init_lock(&lock1);
#pragma omp parallel
        {   
#pragma omp master
            {   
                omp_unset_lock(&lock1); // lock was never set
            }   
        }   
}
-----------------------------
GCC=~/bin/linux-rhel7-x86_64/gcc-4.8.5/gcc-7.3.0-2bfpv2u6zl5wux44mswawrkpzh2fillo/bin/gcc
OMP_PATH=~/bin/linux-rhel7-x86_64/gcc-4.8.5//gcc-7.3.0/llvm-develop-rm4ypf2twg2yxshj5ptucddikviq63to/
INCPATH=-I$(OMP_PATH)/lib/clang/7.0.1/include/

LIBPATH=-Wl,-rpath=$(OMP_PATH)/lib -L$(OMP_PATH)/lib 
LIBS=$(LIBPATH) -lomp

SOURCES=lockbug.c

TARGETS=lockbug

default all:$(TARGETS)

lockbug: $(SOURCES)
        $(GCC) -g -o $@ $(SOURCES) -fopenmp $(INCPATH) $(LIBS)

clean:
        /bin/rm -f $(TARGETS) core*</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>