<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 - pragma omp target causes fopen "fatal error" when compile with preprocessed file"
href="https://bugs.llvm.org/show_bug.cgi?id=48759">48759</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>pragma omp target causes fopen "fatal error" when compile with preprocessed file
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>melanie.blower@intel.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Hello, When I receive a bug report with a preprocessed file, I often do not
receive the original file and the #line markers show the file name belonging to
the customer but not on my server. When compiling this program, a fatal error
is reported. Evidently the file name is scraped from #line instead of using the
file name used to invoke the compiler. Here is test case:
cat newfile-abfeb7.ii
# 1 "nofile.cpp"
void a() {
#pragma omp target
;
}
Here's the invocation:
clang-12 -cc1 -triple x86_64-unknown-linux-gnu -emit-llvm-bc -fopenmp
newfile-abfeb7.ii
Response:
fatal error: cannot open file 'nofile.cpp': No such file or directory
1 error generated.
It appears that CGOpenMPRuntime::registerTargetRegion
(CGOpenMPRuntime.cpp:6421) is called from
CodeGenFunction::EmitLateOutlineOMPDirective, which is trying to open thefile
for some reason. It seems based on the comments to wish to create a unique id
for the ‘target entry’, but it uses the current file’s ‘UniqueID’
(<a href="https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CGOpenMPRuntime.cpp#L1651">https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CGOpenMPRuntime.cpp#L1651</a>)</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>