Skip to content

Compiling with -Z sanitizer=address aborts #45220

Closed
@dgreid

Description

@dgreid

Steps:

git clone https://github.com/burntsushi/byteorder
cd byteorder
RUSTFLAGS="-Z sanitizer=address" cargo build

Error:

rustc: /checkout/src/llvm/include/llvm/ADT/StringRef.h:236: char llvm::StringRef::operator[](size_t) const: Assertion `Index < Length && "Invalid index!"' failed.
error: Could not compile `byteorder`.

Stack trace from GDB:

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffe5bff700 (LWP 74841)]
0x00007ffff7379c37 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff7379c37 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff737d028 in __GI_abort () at abort.c:89
#2  0x00007ffff7372bf6 in __assert_fail_base (fmt=0x7ffff74c7018 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7ffff019e7d8 "Index < Length && \"Invalid index!\"", file=file@entry=0x7ffff02f7b60 "/checkout/src/llvm/include/llvm/ADT/StringRef.h", line=line@entry=236,
    function=function@entry=0x7ffff1343260 <_ZZNK4llvm9StringRefixEmE19__PRETTY_FUNCTION__> "char llvm::StringRef::operator[](size_t) const") at assert.c:92
#3  0x00007ffff7372ca2 in __GI___assert_fail (assertion=0x7ffff019e7d8 "Index < Length && \"Invalid index!\"", file=0x7ffff02f7b60 "/checkout/src/llvm/include/llvm/ADT/StringRef.h", line=236, function=0x7ffff1343260 <_ZZNK4llvm9StringRefixEmE19__PRETTY_FUNCTION__> "char llvm::StringRef::operator[](size_t) const") at assert.c:101
#4  0x00007fffefef4661 in llvm::GlobalValue::getGlobalIdentifier(llvm::StringRef, llvm::GlobalValue::LinkageTypes, llvm::StringRef) () from /usr/local/google/home/dgreid/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-fcc579f01f90936f.so
#5  0x00007fffefef46f1 in llvm::GlobalValue::getGlobalIdentifier() const () from /usr/local/google/home/dgreid/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-fcc579f01f90936f.so
#6  0x00007fffeee10d9d in llvm::GlobalValue::getGUID() const () from /usr/local/google/home/dgreid/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-fcc579f01f90936f.so
#7  0x00007fffefd291b6 in llvm::buildModuleSummaryIndex(llvm::Module const&, std::function<llvm::BlockFrequencyInfo* (llvm::Function const&)>, llvm::ProfileSummaryInfo*)::{lambda(llvm::ValueInfo const&)#2}::operator()(llvm::ValueInfo const&) const () from /usr/local/google/home/dgreid/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-fcc579f01f90936f.so
#8  0x00007fffefd2c25f in llvm::buildModuleSummaryIndex(llvm::Module const&, std::function<llvm::BlockFrequencyInfo* (llvm::Function const&)>, llvm::ProfileSummaryInfo*) () from /usr/local/google/home/dgreid/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-fcc579f01f90936f.so
#9  0x00007fffefd2c8de in llvm::ModuleSummaryIndexWrapperPass::runOnModule(llvm::Module&) () from /usr/local/google/home/dgreid/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-fcc579f01f90936f.so
#10 0x00007fffeff2a60f in llvm::legacy::PassManagerImpl::run(llvm::Module&) () from /usr/local/google/home/dgreid/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-fcc579f01f90936f.so
#11 0x00007fffee79e7d4 in LLVMRustWriteThinBitcodeToFile () from /usr/local/google/home/dgreid/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-fcc579f01f90936f.so
#12 0x00007ffff58d0363 in rustc_trans::back::write::codegen::h48e75414b21460bd () from /usr/local/google/home/dgreid/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-f1fc6dd8a33f17ba.so
#13 0x00007ffff58656e5 in std::sys_common::backtrace::__rust_begin_short_backtrace::ha443b2c90c1dbbde () from /usr/local/google/home/dgreid/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-f1fc6dd8a33f17ba.so
#14 0x00007ffff58679b8 in std::panicking::try::do_call::h768fcd8aa8451e7a () from /usr/local/google/home/dgreid/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-f1fc6dd8a33f17ba.so
#15 0x00007ffff77c3bdd in panic_unwind::__rust_maybe_catch_panic () at /checkout/src/libpanic_unwind/lib.rs:99
#16 0x00007ffff588af63 in _$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$::call_box::hab9046e04a0431df () from /usr/local/google/home/dgreid/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-f1fc6dd8a33f17ba.so
#17 0x00007ffff778820c in call_once<(),()> () at /checkout/src/liballoc/boxed.rs:736
#18 start_thread () at /checkout/src/libstd/sys_common/thread.rs:24
#19 std::sys::imp::thread::{{impl}}::new::thread_start () at /checkout/src/libstd/sys/unix/thread.rs:90
#20 0x00007ffff2638184 in start_thread (arg=0x7fffe5bff700) at pthread_create.c:312
#21 0x00007ffff7440ffd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-codegenArea: Code generationC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions