<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 - Call abort() instead of exit() on runtime error"
href="https://bugs.llvm.org/show_bug.cgi?id=46515">46515</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Call abort() instead of exit() on runtime error
</td>
</tr>
<tr>
<th>Product</th>
<td>OpenMP
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</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>gcc.j.kelling@hzdr.de
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>While debugging a openmp target usage inside a complex program, I found, that
libomptarget calls exit() when it encounters a runtime error, which in my case
causes a deadlock instead of program termination.
Specifically, I am seeing the error message:
"Libomptarget fatal error 1: failure of target construct while offloading is
mandatory"
after which the program is hangs in a deadlock instead of terminating.
I suggest to change this to call abort() instead of exit(). The rationale is
the situation in the program I an working on.
# Rationale
The program implements a queue to run kernels on backends, one of which is
based on OpenMP target offload. In my case I am using a synchronous queue, in
which case, a function A() calling a function B() containing an omp target
region holds a mutex lock on the queue within its scope (std::lock_guard)
(effectively while B() is executing).
Another component of the program registers the same queue in a global object.
That objects destructor is responsible for clearing destructing the queue
before program termination. Part of this is synchronizing the queue, which
requires the mutex held by A() to be locked.
When exit() is called inside B(), the stack is not unwound, i.e. the lock held
by A() is not released, but the destructors of global objects like that queue
wrapper are called, which causes a dead lock. This could be avoided by calling
abort() on runtime errors instead.</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>