Another bug in LLVM OpenMP runtime when compiled in debug mode and exercised using the GNU API

Yesterday, I posted an OpenMP fatal assertion when compiled in debug mode. Here is another. As I stated yesterday, 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 code below with g++ and linking it to the LLVM OpenMP runtime compiled in debug mode produces a fatal error.

The program:

#include <inttypes.h>
#include <stdio.h>
#include <omp.h>

#define NTHREADS 8
#define NBOUND 40

uint64_t result[NBOUND];

uint64_t fib(int n)
{
if (n < 2) return n;
else return fib(n-1) + fib(n-2);
}

void testparallel()
{
#pragma omp parallel num_threads(NTHREADS)
{
#pragma omp for
for(int i = 0; i < NBOUND; i++) result[i] = fib(40);
}
}

void teststatic()
{
#pragma omp parallel for schedule(static)
for(int i = 0; i < NBOUND; i++) result[i] += fib(40);
}

int main(int argc, char **argv)
{
int i;

testparallel();
teststatic();

for(i=0;i< NBOUND;i++) printf("%lld “, result[i]);
printf(”\n");
}

The error:

Assertion failure at kmp_runtime.c(2089): master_th->th.th_task_team == parent_team->t.t_task_team[master_th->th.th_task_state].
OMP: Error #13: Assertion failure at kmp_runtime.c(2089).
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/.

This assertion triggers on both the PPC64 and Intel64 architectures on which I tested it.

When the runtime is not compiled in debug mode, the program runs successfully to completion and produces the same answer as the sequential code.

While the assertion triggers when executing teststatic(), removing the prior call to testparallel() makes the assertion disappear.

Hal,

Sorry to bother you again, but do you know who to contact about adding openmp as a product to the llvm bugzilla site?

– Johnny

From: "Jonathan L Peyton" <jonathan.l.peyton@intel.com>
To: "Hal Finkel" <hfinkel@anl.gov>
Cc: "John Mellor-Crummey" <johnmc@rice.edu>, openmp-dev@dcs-maillist2.engr.illinois.edu
Sent: Tuesday, July 14, 2015 12:15:11 PM
Subject: RE: [Openmp-dev] Another bug in LLVM OpenMP runtime when compiled in debug mode and exercised using the GNU
API

Hal,

Sorry to bother you again, but do you know who to contact about
adding openmp as a product to the llvm bugzilla site?

Not a bother. I believe you e-mail llvm-admin@cs.uiuc.edu (or maybe you just file a bug report)?

-Hal

Filed a bug to add openmp as a product:

https://llvm.org/bugs/show_bug.cgi?id=24119

-- Johnny

John,

We are working on the delivering of the fix to LLVM repository

(this bug had been fixed in our private development area some time ago).

Should be done soon.

Thanks,

Andrey

FYI,

There is now an OpenMP product where bugs can be filed: https://llvm.org/bugs/
When filing a bug for the LLVM OpenMP Runtime Library, you can choose the Runtime Library component.

-- Johnny