Skip to content

LLVM Assertion for basic_types->void_ptr_type #244

@TerryGuo

Description

@TerryGuo

If warm-compiler is built with LLVM that was built in Debug type, then we will get following LLVM assertion when using wamr-compiler:

$ ./wamrc --target=x86_64 -o test.aot test.wasm
Create AoT compiler with:
target: x86_64
target cpu:
cpu features:
opt level: 3
size level: 3
output format: AoT file
wamrc: /etc/llvm-build/llvm-10.0.0.src/lib/IR/Type.cpp:639: static llvm::PointerType* llvm::PointerType::get(llvm::Type*, unsigned int): Assertion `isValidElementType(EltTy) && "Invalid type for pointer element!"' failed.
Aborted

Dig this problem with gdb, got below info:

Program received signal SIGABRT, Aborted.
0x00007ffff0d58277 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install libgcc-4.8.5-39.3.alios7.x86_64 libstdc++-4.8.5-39.3.alios7.x86_64 zlib-1.2.7-16.2.alios7.x86_64
(gdb) bt
#0 0x00007ffff0d58277 in raise () from /lib64/libc.so.6
#1 0x00007ffff0d59968 in abort () from /lib64/libc.so.6
#2 0x00007ffff0d51096 in __assert_fail_base () from /lib64/libc.so.6
#3 0x00007ffff0d51142 in __assert_fail () from /lib64/libc.so.6
#4 0x0000000000606dac in llvm::PointerType::get (EltTy=0x45e3588, AddressSpace=0)
at /etc/llvm-build/llvm-10.0.0.src/lib/IR/Type.cpp:639
#5 0x0000000000453354 in LLVMPointerType (ElementType=0x45e3588, AddressSpace=0)
at /etc/llvm-build/llvm-10.0.0.src/lib/IR/Core.cpp:748
#6 0x0000000000435a4c in aot_set_llvm_basic_types (basic_types=0x45e09a8, context=0x45e0ae0)
at /etc/llvm-build/wasm-micro-runtime/core/iwasm/compilation/aot_llvm.c:691
#7 0x0000000000436dc4 in aot_create_comp_context (comp_data=0x45ddc10, option=0x7fffffffd300)
at /etc/llvm-build/wasm-micro-runtime/core/iwasm/compilation/aot_llvm.c:1146
#8 0x000000000040f6ac in main (argc=1, argv=0x7fffffffd4d8)
at /etc/llvm-build/wasm-micro-runtime/wamr-compiler/main.c:178
(gdb)

Seems it is related to
/etc/llvm-build/wasm-micro-runtime/core/iwasm/compilation/aot_llvm.c:691

Would you please look into it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions