[llvm-bugs] [Bug 51638] New: C API, LLVMGetIntrinsicDeclaration crash trying to get ‘llvm.get.dynamic.area.offset’

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 26 17:49:55 PDT 2021


            Bug ID: 51638
           Summary: C API, LLVMGetIntrinsicDeclaration crash trying to get
           Product: libraries
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Support Libraries
          Assignee: unassignedbugs at nondot.org
          Reporter: b2.temp at gmx.com
                CC: llvm-bugs at lists.llvm.org

The documentation says LLVMGetIntrinsicDeclaration

> Create or insert the declaration of an intrinsic.  For overloaded intrinsics,
> parameter types must be provided to uniquely identify an overload.

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:

>  DecodeFixedType(llvm::ArrayRef<llvm::Intrinsic::IITDescriptor>&, 
>    llvm::ArrayRef<llvm::Type*>, llvm::LLVMContext&) [clone .isra.0]
>  llvm::Intrinsic::getType(llvm::LLVMContext&, unsigned int, 
>    llvm::ArrayRef<llvm::Type*>)
>  llvm::Intrinsic::getDeclaration(llvm::Module*, unsigned int, > 
>    llvm::ArrayRef<llvm::Type*>)

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.

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/20210827/a499ca1f/attachment.html>

More information about the llvm-bugs mailing list