<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 compilation fails with -save-temps"
href="https://llvm.org/bugs/show_bug.cgi?id=22926">22926</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Cuda compilation fails with -save-temps
</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>Driver
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>tra@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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.</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>