<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 declare mapper causes segmentation fault"
   href="https://bugs.llvm.org/show_bug.cgi?id=49698">49698</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>OpenMP declare mapper causes segmentation fault
          </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>Runtime Library
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jtramm@anl.gov
          </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=24686" name="attach_24686" title="reproducer">attachment 24686</a> <a href="attachment.cgi?id=24686&action=edit" title="reproducer">[details]</a></span>
reproducer

The use of an OpenMP declare mapper for performing deep copies on a multi-level
object hierarchy appears to result in a segmentation fault. The seg fault
occurs on the host after after copying data from host -> device -> host.

Compiler Version: 13.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
d70185ec4821f7960c4fe10961479d97e816da68)

Platform: Intel host + NVIDIA V100 GPU target

Compilation:

clang++ -Wall -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target
-march=sm_70 main.cpp

Runtime Behavior:

<span class="quote">>$ ./a.out</span >
Original data hierarchy:
Object C Contents:
        Object B Contents:
                Object A Contents:
                        data1 = 1  data2 = 2
                Object A Contents:
                        data1 = 1  data2 = 2
        Object B Contents:
                Object A Contents:
                        data1 = 1  data2 = 2
                Object A Contents:
                        data1 = 1  data2 = 2
Object C Contents:
        Object B Contents:
                Object A Contents:
                        data1 = 1  data2 = 2
                Object A Contents:
                        data1 = 1  data2 = 2
        Object B Contents:
                Object A Contents:
                        data1 = 1  data2 = 2
                Object A Contents:
                        data1 = 1  data2 = 2
Sending data to device...
Calling foo()...
foo() complete!
Sending data back to host...
Modified Data Hierarchy:
Object C Contents:
        Object B Contents:
                Object A Contents:
Segmentation fault</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>