Issue 239743
Summary bug: valgrind report issues with llvm when passing rustc to valgrind
Labels new issue
Assignees
Reporter HackingRepo
    I tried via

```bash
relunsec@relunsec:~/tldidentify$ valgrind $(rustup which rustc)
==183955== Memcheck, a memory error detector
==183955== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==183955== Using Valgrind-3.26.0 and LibVEX; rerun with -h for copyright info
==183955== Command: /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc
==183955== 
==183955== Mismatched free() / delete / delete []
==183955==    at 0x4AED494: operator delete[](void*) (vg_replace_malloc.c:1413)
==183955== by 0x16ED30B8: std::_Function_base::_Base_manager<std::function<void (int)> >::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation) (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.23.1-rust-1.101.0-nightly)
==183955== by 0x16ED2A88: _GLOBAL__sub_I_OptBisect.cpp (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.23.1-rust-1.101.0-nightly)
==183955== by 0x42A27CE: call_init.part.0 (dl-init.c:74)
==183955==    by 0x42A28E3: call_init (dl-init.c:120)
==183955==    by 0x42A28E3: _dl_init (dl-init.c:121)
==183955==    by 0x42BF39F: ??? (in /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
==183955==  Address 0x187c07d0 is 0 bytes inside a block of size 32 alloc'd
==183955==    at 0x4AE7FD3: operator new(unsigned long) (vg_replace_malloc.c:488)
==183955== by 0x16ED29B2: _GLOBAL__sub_I_OptBisect.cpp (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.23.1-rust-1.101.0-nightly)
==183955== by 0x42A27CE: call_init.part.0 (dl-init.c:74)
==183955==    by 0x42A28E3: call_init (dl-init.c:120)
==183955==    by 0x42A28E3: _dl_init (dl-init.c:121)
==183955==    by 0x42BF39F: ??? (in /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
==183955== 
==183955== Mismatched free() / delete / delete []
==183955==    at 0x4AED494: operator delete[](void*) (vg_replace_malloc.c:1413)
==183955==    by 0x16ED30B8: std::_Function_base::_Base_manager<std::function<void (int)> >::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation) (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.23.1-rust-1.101.0-nightly)
==183955== by 0x16ED3049: void llvm::cl::cb<void, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::apply<llvm::cl::list<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >(llvm::cl::list<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) const (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.23.1-rust-1.101.0-nightly)
==183955== by 0x16ED2E8F: _GLOBAL__sub_I_OptBisect.cpp (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.23.1-rust-1.101.0-nightly)
==183955== by 0x42A27CE: call_init.part.0 (dl-init.c:74)
==183955==    by 0x42A28E3: call_init (dl-init.c:120)
==183955==    by 0x42A28E3: _dl_init (dl-init.c:121)
==183955==    by 0x42BF39F: ??? (in /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
==183955==  Address 0x187c0890 is 0 bytes inside a block of size 32 alloc'd
==183955==    at 0x4AE7FD3: operator new(unsigned long) (vg_replace_malloc.c:488)
==183955== by 0x16ED2F67: void llvm::cl::cb<void, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::apply<llvm::cl::list<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >(llvm::cl::list<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) const (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.23.1-rust-1.101.0-nightly)
==183955== by 0x16ED2E8F: _GLOBAL__sub_I_OptBisect.cpp (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.23.1-rust-1.101.0-nightly)
==183955== by 0x42A27CE: call_init.part.0 (dl-init.c:74)
==183955==    by 0x42A28E3: call_init (dl-init.c:120)
==183955==    by 0x42A28E3: _dl_init (dl-init.c:121)
==183955==    by 0x42BF39F: ??? (in /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
==183955== 
==183955== Mismatched free() / delete / delete []
==183955==    at 0x4AED494: operator delete[](void*) (vg_replace_malloc.c:1413)
==183955==    by 0x16ED30B8: std::_Function_base::_Base_manager<std::function<void (int)> >::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation) (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.23.1-rust-1.101.0-nightly)
==183955== by 0x16ED3049: void llvm::cl::cb<void, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::apply<llvm::cl::list<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >(llvm::cl::list<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) const (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.23.1-rust-1.101.0-nightly)
==183955== by 0x16EC32F5: _GLOBAL__sub_I_Debugify.cpp (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.23.1-rust-1.101.0-nightly)
==183955== by 0x42A27CE: call_init.part.0 (dl-init.c:74)
==183955==    by 0x42A28E3: call_init (dl-init.c:120)
==183955==    by 0x42A28E3: _dl_init (dl-init.c:121)
==183955==    by 0x42BF39F: ??? (in /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
==183955==  Address 0x187d2540 is 0 bytes inside a block of size 32 alloc'd
==183955==    at 0x4AE7FD3: operator new(unsigned long) (vg_replace_malloc.c:488)
==183955== by 0x16ED2F67: void llvm::cl::cb<void, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::apply<llvm::cl::list<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >(llvm::cl::list<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) const (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.23.1-rust-1.101.0-nightly)
==183955== by 0x16EC32F5: _GLOBAL__sub_I_Debugify.cpp (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.23.1-rust-1.101.0-nightly)
==183955== by 0x42A27CE: call_init.part.0 (dl-init.c:74)
==183955==    by 0x42A28E3: call_init (dl-init.c:120)
==183955==    by 0x42A28E3: _dl_init (dl-init.c:121)
==183955==    by 0x42BF39F: ??? (in /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
==183955== 
Usage: rustc [OPTIONS] INPUT

Options:
    -h, --help          Display this message
 --cfg <SPEC>    Configure the compilation environment.
 SPEC supports the syntax `<NAME>[="<VALUE>"]`.
        --check-cfg <SPEC>
                        Provide list of expected cfgs for checking
 -L [<KIND>=]<PATH>  Add a directory to the library search path. The
 optional KIND can be one of
 <dependency|crate|native|framework|all> (default:
 all).
    -l [<KIND>[:<MODIFIERS>]=]<NAME>[:<RENAME>]
 Link the generated crate(s) to the specified native
 library NAME. The optional KIND can be one of
 <static|framework|dylib> (default: dylib).
                        Optional comma separated MODIFIERS
 <bundle|verbatim|whole-archive|as-needed>
                        may be specified each with a prefix of either '+' to
                        enable or '-' to disable.
        --crate-type <bin|lib|rlib|dylib|cdylib|staticlib|proc-macro>
 Comma separated list of types of crates
                        for the compiler to emit
        --crate-name <NAME>
 Specify the name of the crate being built
        --edition <2015|2018|2021|2024|future>
                        Specify which edition of the compiler to use when
                        compiling code. The default is 2015 and the latest
                        stable edition is 2024.
        --emit <TYPE>[=<FILE>]
                        Comma separated list of types of output for the
                        compiler to emit.
                        Each TYPE has the default FILE name:
 * asm - CRATE_NAME.s
                        * llvm-bc - CRATE_NAME.bc
                        * dep-info - CRATE_NAME.d
 * link - (platform and crate-type dependent)
 * llvm-ir - CRATE_NAME.ll
                        * metadata - libCRATE_NAME.rmeta
                        * mir - CRATE_NAME.mir
 * obj - CRATE_NAME.o
                        * thin-link-bitcode - CRATE_NAME.indexing.o
        --print <INFO>[=<FILE>]
 Compiler information to print on stdout (or to a file)
                        INFO may be one of
 <all-target-specs-json|backend-has-mnemonic|backend-has-zstd|calling-conventions|cfg|check-cfg|code-models|crate-name|crate-root-lint-levels|deployment-target|file-names|host-tuple|link-args|native-static-libs|relocation-models|split-debuginfo|stack-protector-strategies|supported-crate-types|sysroot|target-cpus|target-features|target-libdir|target-list|target-spec-json|target-spec-json-schema|tls-models|wasm-proc-macro-tuple>.
 -g                  Equivalent to -C debuginfo=2
    -O Equivalent to -C opt-level=3
    -o <FILENAME>       Write output to FILENAME
        --out-dir <DIR> Write output to compiler-chosen filename in DIR
        --explain <OPT> Provide a detailed explanation of an error message
        --test          Build a test harness
        --target <TARGET>
                        Target tuple for which the code is compiled
    -A, --allow <LINT>  Set lint allowed
    -W, --warn <LINT> Set lint warnings
        --force-warn <LINT>
                        Set lint force-warn
    -D, --deny <LINT>   Set lint denied
    -F, --forbid <LINT> Set lint forbidden
        --cap-lints <LEVEL>
 Set the most restrictive lint level. More restrictive
 lints are capped at this level
    -C, --codegen <OPT>[=<VALUE>]
 Set a codegen option
    -V, --version       Print version info and exit
    -v, --verbose       Use verbose output

Additional help:
    -C help             Print codegen options
    -W help Print 'lint' options and default settings
    -Z help             Print unstable compiler options
    --help -v           Print the full set of options rustc accepts

==183955== Thread 3 rustc:
==183955== Mismatched free() / delete / delete []
==183955==    at 0x4AEA8BF: free (vg_replace_malloc.c:990)
==183955==    by 0xB888FC0: LLVMRustCreateMCSubtargetInfo (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-ec450ccfc567e426.so)
==183955== by 0xB8891A8: <rustc_codegen_llvm::back::llvm_backend::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::target_config (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-ec450ccfc567e426.so)
==183955== by 0xB9C0903: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2} (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-ec450ccfc567e426.so)
==183955== by 0xB9F27E3: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-ec450ccfc567e426.so)
==183955== by 0xB9F258A: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-ec450ccfc567e426.so)
==183955== by 0xB9ED75A: <std::sys::thread::unix::Thread>::new::thread_start (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-ec450ccfc567e426.so)
==183955== by 0xD49BDF9: start_thread (pthread_create.c:454)
==183955==    by 0xD52F3D3: clone (clone.S:100)
==183955==  Address 0x188d31c0 is 0 bytes inside a block of size 31 alloc'd
==183955==    at 0x4AE7FD3: operator new(unsigned long) (vg_replace_malloc.c:488)
==183955==    by 0x16CB0DEA: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::reserve(unsigned long) (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.23.1-rust-1.101.0-nightly)
==183955== by 0x16CB0D32: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > llvm::detail::join_impl<llvm::StringRef*>(llvm::StringRef*, llvm::StringRef*, llvm::StringRef, std::forward_iterator_tag) (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.23.1-rust-1.101.0-nightly)
==183955== by 0x16CB0C2F: llvm::Triple::normalize[abi:cxx11](llvm::StringRef, llvm::Triple::CanonicalForm) (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.23.1-rust-1.101.0-nightly)
==183955== by 0xB888F17: LLVMRustCreateMCSubtargetInfo (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-ec450ccfc567e426.so)
==183955== by 0xB8891A8: <rustc_codegen_llvm::back::llvm_backend::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::target_config (in /home/relunsec/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-ec450ccfc567e426.<truncated>Please see the issue for the entire body.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to