[llvm-bugs] [Bug 49839] New: CUDA pure virtual inheritance issue

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Apr 4 22:38:49 PDT 2021


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

            Bug ID: 49839
           Summary: CUDA pure virtual inheritance issue
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: CUDA
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kjain14 at utexas.edu
                CC: llvm-bugs at lists.llvm.org

Created attachment 24719
  --> https://bugs.llvm.org/attachment.cgi?id=24719&action=edit
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 (https://github.com/llvm/llvm-project.git
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.

-- 
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/20210405/f4a797b8/attachment.html>


More information about the llvm-bugs mailing list