<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 - OpenMP tasks: Private variables not captured"
href="https://bugs.llvm.org/show_bug.cgi?id=37671">37671</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>OpenMP tasks: Private variables not captured
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Clang Compiler Support
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>schuchart@hlrs.de
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=20387" name="attach_20387" title="Test case">attachment 20387</a> <a href="attachment.cgi?id=20387&action=edit" title="Test case">[details]</a></span>
Test case
Clang seems to fail to capture private variables in OpenMP untied tasks, which
leads to corrupted values after returning from a taskyield region. Attached is
a test case that prints the value of task local variables, which are generated
by thread 0 by incrementing a shared variable.
The results seen are:
```
[0] task_id 0 : flag_one_cntr 1 : flag_two_cntr 0
[0] task_id 0 : flag_one_cntr 3 : flag_two_cntr 1
[0] task_id 0 : flag_one_cntr 4 : flag_two_cntr 1
[0] task_id 0 : flag_one_cntr 5 : flag_two_cntr 3
[0] task_id 0 : flag_one_cntr 6 : flag_two_cntr 3
[0] task_id 0 : flag_one_cntr 8 : flag_two_cntr 4
[0] task_id 0 : flag_one_cntr 8 : flag_two_cntr 5
[0] task_id 0 : flag_one_cntr 9 : flag_two_cntr 7
[0] task_id 0 : flag_one_cntr 11 : flag_two_cntr 8
```
The expected result is:
```
[0] task_id 257 : flag_one_cntr 257 : flag_two_cntr 0
[0] task_id 256 : flag_one_cntr 257 : flag_two_cntr 1
[0] task_id 255 : flag_one_cntr 257 : flag_two_cntr 2
[0] task_id 254 : flag_one_cntr 257 : flag_two_cntr 3
[0] task_id 253 : flag_one_cntr 257 : flag_two_cntr 4
[0] task_id 252 : flag_one_cntr 257 : flag_two_cntr 5
[0] task_id 251 : flag_one_cntr 257 : flag_two_cntr 6
[0] task_id 250 : flag_one_cntr 257 : flag_two_cntr 7
[0] task_id 249 : flag_one_cntr 257 : flag_two_cntr 8
```
The value of task_id is corrupted and does not reflect the increment of the
variables from which it is assigned.
Interestingly, the behavior seems correct if either of the taskyield regions is
commented out.
Tested using vanilla Clang 6.0.
I'm happy to provide any additional information if required.</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>