[Openmp-dev] Bug in OpenMP runtime when compiled in debug mode and exercised using the GNU API

John Mellor-Crummey johnmc at rice.edu
Mon Jul 13 10:00:33 PDT 2015

I would file this bug with bugzilla, but I can’t figure out where the OpenMP bugs should go. If someone could enlighten me, I’d be grateful.

Compiling the simple code below with g++ and linking it to the LLVM OpenMP runtime compiled in debug mode produces a fatal error.

The program:

#include <omp.h>

#define NUM_THREADS 2

int fib(int i)
  if (i < 2) return i;
  else return fib(i-1) + fib(i-2);

int main(int argc, char **argv)
  int i, inner_threads;
  for (inner_threads = 1; inner_threads <= NUM_THREADS; inner_threads++) {
#pragma omp parallel for schedule(runtime) num_threads(inner_threads)
    for (i = 0; i < NUM_THREADS; i++) {
  return 0;

The error:

Assertion failure at kmp_dispatch.cpp(1392): p_last && p_lb && p_ub && p_st.
OMP: Error #13: Assertion failure at kmp_dispatch.cpp(1392).
OMP: Hint: Please submit a bug report with this message, compile and run commands used, and machine configuration info including native compiler and operating system versions. Faster response will be obtained by including all program sources. For information on submitting this issue, please see http://www.intel.com/software/products/support/.

The explanation:

On line 642 of kmp_gsupport.c, there is a call to 

  status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, (kmp_int *)p_lb,        \
               (kmp_int *)p_ub, (kmp_int *)&stride);  

The NULL is passed to the parameter shown in red below

template< typename T >
static int
    ident_t *loc, int gtid, kmp_int32 *p_last, T *p_lb, T *p_ub, typename traits_t< T >::signed_t *p_st

This always fails the assertion below from line 1392 of kmp_dispatch.c

    KMP_DEBUG_ASSERT( p_last && p_lb && p_ub && p_st ); // AC: these cannot be NULL

I could fix it by eliminating the debug assertion, but I think it would be better for someone who understands the kmp dispatching mechanisms to think about how they are being used from the GOMP wrappers.

John Mellor-Crummey         Professor
Dept of Computer Science    Rice University
email: johnmc at rice.edu      phone: 713-348-5179

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20150713/3109b9a5/attachment.html>

More information about the Openmp-dev mailing list