Open makise-homura opened 3 years ago
Simple reproduction example (lzip_index.cc
):
class Lzip_index
{
const long long insize;
public:
Lzip_index();
};
Lzip_index::Lzip_index() : insize(0) {;}
Build: clang++-10 -S -emit-llvm -g -o lzip_index.ll lzip_index.cc && ./llvm-cbe lzip_index.ll
I seem to be getting a similar error with archive.cpp
from UnRAR source (https://www.rarlab.com/rar/unrarsrc-6.0.6.tar.gz).
/usr/lib/x86_64-linux-gnu/libLLVM-10.so.1(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x1f)[0x7f35a5700c8f]
/usr/lib/x86_64-linux-gnu/libLLVM-10.so.1(_ZN4llvm3sys17RunSignalHandlersEv+0x22)[0x7f35a56fef22]
/usr/lib/x86_64-linux-gnu/libLLVM-10.so.1(+0xb21255)[0x7f35a5701255]
/lib/x86_64-linux-gnu/libc.so.6(+0x3bd60)[0x7f35a470bd60]
/usr/lib/x86_64-linux-gnu/libLLVM-10.so.1(_ZNK4llvm10DataLayout16getAlignmentInfoENS_13AlignTypeEnumEjbPNS_4TypeE+0x4c)[0x7f35a579289c]
[0xe94600]
Stack dump:
0. Program arguments: ./llvm-cbe --cbe-declare-locals-late archive.ll
[1] 23956 segmentation fault (core dumped) ./llvm-cbe --cbe-declare-locals-late
I ran llvm-cbe archive.ll
through valgrind's memcheck as well,
Invalid read of size 4
at 0x541389C: operator() (llvm/lib/IR/DataLayout.cpp:481)
by 0x541389C: partition_point<llvm::LayoutAlignElem *, (lambda at /build/llvm-toolchain-10-10.0.1~++20210313014605+ef32c611aa21/llvm/lib/IR/DataLayout.cpp:480:38)> (stl_algo.h:626)
by 0x541389C: partition_point<llvm::SmallVector<llvm::LayoutAlignElem, 16> &, (lambda at /build/llvm-toolchain-10-10.0.1~++20210313014605+ef32c611aa21/llvm/lib/IR/DataLayout.cpp:480:38), llvm::LayoutAlignElem &> (llvm/include/llvm/ADT/STLExtras.h:1320)
by 0x541389C: findAlignmentLowerBound (llvm/lib/IR/DataLayout.cpp:480)
by 0x541389C: findAlignmentLowerBound (llvm/include/llvm/IR/DataLayout.h:149)
by 0x541389C: llvm::DataLayout::getAlignmentInfo(llvm::AlignTypeEnum, unsigned int, bool, llvm::Type*) const (llvm/lib/IR/DataLayout.cpp:542)
by 0x9A9B59F: ???
by 0x44ABF7: llvm_cbe::CWriter::doFinalization(llvm::Module&) (lib/Target/CBackend/CBackend.cpp:2322)
by 0x5488100: llvm::FPPassManager::doFinalization(llvm::Module&) (llvm/lib/IR/LegacyPassManager.cpp:1535)
by 0x54885C1: runOnModule (llvm/lib/IR/LegacyPassManager.cpp:1611)
by 0x54885C1: llvm::legacy::PassManagerImpl::run(llvm::Module&) (llvm/lib/IR/LegacyPassManager.cpp:1694)
by 0x416744: compileModule(char**, llvm::LLVMContext&) (tools/llvm-cbe/llvm-cbe.cpp:427)
by 0x415524: main (tools/llvm-cbe/llvm-cbe.cpp:242)
Address 0xfdc8e647f4ed9308 is not stack'd, malloc'd or (recently) free'd
Process terminating with default action of signal 11 (SIGSEGV)
General Protection Fault
at 0x541389C: operator() (llvm/lib/IR/DataLayout.cpp:481)
by 0x541389C: partition_point<llvm::LayoutAlignElem *, (lambda at /build/llvm-toolchain-10-10.0.1~++20210313014605+ef32c611aa21/llvm/lib/IR/DataLayout.cpp:480:38)> (stl_algo.h:626)
by 0x541389C: partition_point<llvm::SmallVector<llvm::LayoutAlignElem, 16> &, (lambda at /build/llvm-toolchain-10-10.0.1~++20210313014605+ef32c611aa21/llvm/lib/IR/DataLayout.cpp:480:38), llvm::LayoutAlignElem &> (llvm/include/llvm/ADT/STLExtras.h:1320)
by 0x541389C: findAlignmentLowerBound (llvm/lib/IR/DataLayout.cpp:480)
by 0x541389C: findAlignmentLowerBound (llvm/include/llvm/IR/DataLayout.h:149)
by 0x541389C: llvm::DataLayout::getAlignmentInfo(llvm::AlignTypeEnum, unsigned int, bool, llvm::Type*) const (llvm/lib/IR/DataLayout.cpp:542)
by 0x9A9B59F: ???
by 0x44ABF7: llvm_cbe::CWriter::doFinalization(llvm::Module&) (lib/Target/CBackend/CBackend.cpp:2322)
by 0x5488100: llvm::FPPassManager::doFinalization(llvm::Module&) (llvm/lib/IR/LegacyPassManager.cpp:1535)
by 0x54885C1: runOnModule (llvm/lib/IR/LegacyPassManager.cpp:1611)
by 0x54885C1: llvm::legacy::PassManagerImpl::run(llvm::Module&) (llvm/lib/IR/LegacyPassManager.cpp:1694)
by 0x416744: compileModule(char**, llvm::LLVMContext&) (tools/llvm-cbe/llvm-cbe.cpp:427)
by 0x415524: main (tools/llvm-cbe/llvm-cbe.cpp:242)
Say, we have LLVM 10.0.0, and just have built
llvm-cbe
in current directory.Trying to build
lzip_index.cc
fromplzip-1.9
withlzlib-1.12
:And it crashes with
SIGSEGV
with the following stack trace:The same is on LLVM 11.0.0 and 9.0.0 (but no stack trace somehow). Interestingly, on LLVM 8.0.0, there is no failure,
.cbe.c
output is being produced correctly, but issue #132 occurs then.