[LLVMbugs] [Bug 22926] New: Cuda compilation fails with -save-temps

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 16 13:22:31 PDT 2015


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

            Bug ID: 22926
           Summary: Cuda compilation fails with -save-temps
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tra at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

clang 'forgets' that it compiles a cuda file after preprocessor phase when
-save-temps is passed. It attempts to compile preprocessed file as plain C++
and that fails if the source code contains any kernel launches.

simple.cu:
========================================
int cudaConfigureCall(int, int);
__attribute__((global)) void kernel() {}

void func() {
     kernel<<<1,1>>>();
}
========================================

# This succeeds
#clang  -fsyntax-only  simple.cu

# This fails:
#clang  -fsyntax-only -save-temps simple.cu
simple.cu:2:16: warning: 'global' attribute ignored [-Wignored-attributes]
__attribute__((global)) void kernel() {}
               ^
simple.cu:5:14: error: expected expression
     kernel<<<1,1>>>();
             ^
simple.cu:5:20: error: expected expression
     kernel<<<1,1>>>();
                   ^
simple.cu:5:22: error: expected expression
     kernel<<<1,1>>>();
                     ^
1 warning and 3 errors generated.

-- 
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/20150316/fe5c0a19/attachment.html>


More information about the llvm-bugs mailing list