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

            Bug ID: 51638
           Summary: C API, LLVMGetIntrinsicDeclaration crash trying to get
                    ‘llvm.get.dynamic.area.offset’
           Product: libraries
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Support Libraries
          Assignee: unassignedb...@nondot.org
          Reporter: b2.t...@gmx.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to