[LLVMbugs] [Bug 20886] New: Clang CUDA - doesn't enforce target matching for method calls

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Sep 9 07:59:18 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20886

            Bug ID: 20886
           Summary: Clang CUDA - doesn't enforce target matching for
                    method calls
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eliben at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ cat method-target-mismatch.cu 
struct S {
  void method() {}
};

__attribute__((device)) void foo() {
  S s;
  s.method();
}

When compiled with nvcc:

$ /usr/local/cuda/bin/nvcc --verbose  -I/usr/local/cuda/include -m64
--gpu-architecture=compute_35 -c method-target-mismatch.cu
...

method-target-mismatch.cu(7): error: calling a __host__ function("S::method")
from a __device__ function("foo") is not allowed


When compiled with Clang (trunk):

$ $LLVMSVN/clang -cc1  -x cuda   method-target-mismatch.cu
$

No error generated.

Clang *does* generate an error when the mismatch is for a function (not
method), or a special method like default constructor.

-- 
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/20140909/b0762c66/attachment.html>


More information about the llvm-bugs mailing list