mold
mold copied to clipboard
msan failure
Currently, mold fails if compiled with MemorySanitizer. This needs fixing.
$ make -j`nproc` CXX=clang++-14 CXXFLAGS='-fsanitize=memory -g -Og -fno-omit-frame-pointer' LDFLAGS='-fsanitize=memory -fuse-ld=lld' USE_MIMALLOC=0 test
...
SUMMARY: MemorySanitizer: use-of-uninitialized-value /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/fs_path.h:1262:14 in std::filesystem::__cxx11::path::filename() const
Exiting
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Makefile.linux:6: elf/init-array-priorities.sh] Error 1
Testing dead-debug-sections ... ==213403==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x55f8bb84bbf1 in std::filesystem::__cxx11::path::filename() const /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/fs_path.h:1262:14
#1 0x55f8bb84b2dd in main /home/ruiu/mold/main.cc:41:45
#2 0x7f4dd6309d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
...
I failed to reproduce this in current HEAD (b5bfe4c607b25d19de7d3b451f6ce329a341441b). Has this already been fixed intentionally? or just resolved luckily?
It's still failing on my machine. Maybe it's specific to libstdc++12?
It (successfully ?) comes to fail on my machine after I removed my libstdc++ and re-installed libstdc++-12.
But to run the msan, I have to add CC=clang-14 to the make options. I finally ran the command below.
make -j`nproc` CC=clang-14 CXX=clang++-14 CXXFLAGS='-fsanitize=memory -g -Og -fno-omit-frame-pointer' LDFLAGS='-fsanitize=memory -fuse-ld=lld' USE_MIMALLOC=0 test
I will try to use libc++ with msan instead of libstdc++ and check whether it fails.