<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 - CUDA pure virtual inheritance issue"
   href="https://bugs.llvm.org/show_bug.cgi?id=49839">49839</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>CUDA pure virtual inheritance issue
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>CUDA
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kjain14@utexas.edu
          </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=24719" name="attach_24719" title="Program showing issue">attachment 24719</a> <a href="attachment.cgi?id=24719&action=edit" title="Program showing issue">[details]</a></span>
Program showing issue

CUDA pure virtual inheritance issue:

Summary:

The attached program initializes a class with a pure virtual method and
overrides this pure virtual method in a child class.
This program fails to compile in Clang CUDA with no optimization applied.
However, this program does compile under certain 
optimization settings: -O1, and -O2.

Description:

The attached program initializes a class with a pure virtual method, and a
child class which overrides this pure virtual method.

We use Clang Trunk (SHA: 1cc9d949a1233e8b17b3b345ccb67ca7296c1a6c) to compile
the attached program.

Compiling the attached program in Clang CUDA fails, while also outputting the
following errors:
    ptxas fatal   : Cannot take address of function '__cxa_pure_virtual' 
    clang-13: error: ptxas command failed with exit code 255 (use -v to see
invocation)
    clang version 13.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
1cc9d949a1233e8b17b3b345ccb67ca7296c1a6c)
    Target: x86_64-unknown-linux-gnu
    Thread model: posix
    InstalledDir: /home/kjain/projects/llvm-project/build/bin
    clang-13: note: diagnostic msg: 
    ********************

    PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
    Preprocessed source(s) and associated run script(s) are located at:
    clang-13: note: diagnostic msg: /tmp/22-3e3111.cu
    clang-13: note: diagnostic msg: /tmp/22-aee9af.cu
    clang-13: note: diagnostic msg: /tmp/22-3e3111.sh
    clang-13: note: diagnostic msg: 

    ********************

This same program compiles successfully under optimization settings -O1 and
-O2, while failing under the optimization setting -O0.

This program also compiles successfully in nvcc.

The files outputted by clang-13 are also attached.</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>