<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 - C API, LLVMGetIntrinsicDeclaration crash trying to get ‘llvm.get.dynamic.area.offset’"
href="https://bugs.llvm.org/show_bug.cgi?id=51638">51638</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>C API, LLVMGetIntrinsicDeclaration crash trying to get ‘llvm.get.dynamic.area.offset’
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>11.0
</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>Support Libraries
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>b2.temp@gmx.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>The documentation says LLVMGetIntrinsicDeclaration
<span class="quote">> Create or insert the declaration of an intrinsic. For overloaded intrinsics,
> parameter types must be provided to uniquely identify an overload.</span >
But "llvm.get.dynamic.area.offset.i64" does not have parameter, so
by the doc it looks like that it can be retrieved using something like
```
auto id = LLVMLookupIntrinsicID(str, strlen(str));
auto str = "llvm.get.dynamic.area.offset.i64";
auto f = LLVMGetIntrinsicDeclaration(mod, id, null, 0);
```
which crashes LLVM:
<span class="quote">> DecodeFixedType(llvm::ArrayRef<llvm::Intrinsic::IITDescriptor>&,
> llvm::ArrayRef<llvm::Type*>, llvm::LLVMContext&) [clone .isra.0]</span >
>
<span class="quote">> llvm::Intrinsic::getType(llvm::LLVMContext&, unsigned int,
> llvm::ArrayRef<llvm::Type*>)</span >
>
<span class="quote">> llvm::Intrinsic::getDeclaration(llvm::Module*, unsigned int, >
> llvm::ArrayRef<llvm::Type*>)</span >
however passing the return type so `LLVMInt64Type()` type instead of null and
then `1` as parameter count works fine.
This is strange since the suffix of the string used to identify the instrinsic
should give the return type.</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>