| Issue |
74323
|
| Summary |
Clang-18 crash when compiled with -O -fsanitize=dataflow -c.
|
| Labels |
|
| Assignees |
|
| Reporter |
iamanonymouscs
|
Clang-18 with -O -fsanitize=dataflow -c crashes on the test case.
Compiler explorer: https://godbolt.org/z/6WYo54bsq
```
$cat mutant.c
extern void *memmove(void *, void *, __SIZE_TYPE__);
typedef int (*T) ();
static T i = (T) memmove;
int main() { i(); }
$clang-18 -O -fsanitize=dataflow -c mutant.c
mutant.c:1:14: warning: incompatible redeclaration of library function 'memmove' [-Wincompatible-library-redeclaration]
1 | extern void *memmove(void *, void *, __SIZE_TYPE__);
| ^
mutant.c:1:14: note: 'memmove' is a builtin with type 'void *(void *, const void *, unsigned long)'
terminate called after throwing an instance of 'std::length_error'
what(): vector::_M_range_insert
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: clang-18 -O -fsanitize=dataflow -c mutant.c
1. <eof> parser at end of file
2. Optimizer
#0 0x00007f012d282266 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xd2b266)
#1 0x00007f012d280170 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xd29170)
#2 0x00007f012d2818c4 llvm::sys::CleanupOnSignal(unsigned long) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xd2a8c4)
#3 0x00007f012d1cfbb0 (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xc78bb0)
#4 0x00007f0137d63980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
#5 0x00007f012b783e87 raise /build/glibc-CVJwZb/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#6 0x00007f012b7857f1 abort /build/glibc-CVJwZb/glibc-2.27/stdlib/abort.c:81:0
#7 0x00007f012c197646 (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xa0646)
#8 0x00007f012c1a8f06 (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xb1f06)
#9 0x00007f012c1a8f71 (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xb1f71)
#10 0x00007f012c1a91b4 (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xb21b4)
#11 0x00007f012c19a7f7 std::__throw_length_error(char const*) (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xa37f7)
#12 0x00007f012df40514 (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0x19e9514)
#13 0x00007f012df3d114 (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0x19e6114)
#14 0x00007f012df2fe20 (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0x19d8e20)
#15 0x00007f012df2cb9f llvm::DataFlowSanitizerPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0x19d5b9f)
#16 0x00007f0135a74b6d (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x1aedb6d)
#17 0x00007f012d3fc864 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xea5864)
#18 0x00007f0135a6bd43 (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x1ae4d43)
#19 0x00007f0135a64d52 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x1addd52)
#20 0x00007f0135dfb5fe (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x1e745fe)
#21 0x00007f0134a17866 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xa90866)
#22 0x00007f013686f645 clang::FrontendAction::Execute() (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x28e8645)
#23 0x00007f01367edcc4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x2866cc4)
#24 0x00007f01368ea1c0 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x29631c0)
#25 0x0000559f8b628837 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm-18/bin/clang+0x13837)
#26 0x0000559f8b625905 (/usr/lib/llvm-18/bin/clang+0x10905)
#27 0x00007f0136485909 (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x24fe909)
#28 0x00007f012d1cf94c llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xc7894c)
#29 0x00007f01364852ae clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x24fe2ae)
#30 0x00007f013644d0f1 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x24c60f1)
#31 0x00007f013644d33e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x24c633e)
#32 0x00007f013646939c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x24e239c)
#33 0x0000559f8b62525c clang_main(int, char**, llvm::ToolContext const&) (/usr/lib/llvm-18/bin/clang+0x1025c)
#34 0x0000559f8b632f32 main (/usr/lib/llvm-18/bin/clang+0x1df32)
#35 0x00007f012b766c87 __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:344:0
#36 0x0000559f8b6221ea _start (/usr/lib/llvm-18/bin/clang+0xd1ea)
clang-18: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Ubuntu clang version 18.0.0 (++20231018091808+48a53509e851-1~exp1~20231018091910.1571)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-18: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-18: note: diagnostic msg: /tmp/mutant-8a306a.c
clang-18: note: diagnostic msg: /tmp/mutant-8a306a.sh
clang-18: note: diagnostic msg:
********************
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs