[llvm-bugs] [Bug 37671] New: OpenMP tasks: Private variables not captured

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 4 00:26:37 PDT 2018


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

            Bug ID: 37671
           Summary: OpenMP tasks: Private variables not captured
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: schuchart at hlrs.de
                CC: llvm-bugs at lists.llvm.org

Created attachment 20387
  --> https://bugs.llvm.org/attachment.cgi?id=20387&action=edit
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180604/217b1efa/attachment.html>


More information about the llvm-bugs mailing list