<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58784>58784</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang++ ICE with libc++
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
RungeCC
</td>
</tr>
</table>
<pre>
- OS linux 6.0.6 x86_64
- clang++ 16.0.0 f33173acd6875fa86448bb6d91bdac8f1296510a()
- libc++ 16.0.0 00b09a7b18ab
clang complains:
```
clang-16: warning: -lc++: 'linker' input unused [-Wunused-command-line-argument]
clang-16: warning: argument unused during compilation: '-L/usr/local/lib' [-Wunused-command-line-argument]
free(): invalid pointer
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: /usr/bin/clang++ -nostdinc++ -nostdlib++ -isystem /usr/local/include/c++/v1 -L /usr/local/lib -lc++ -g -std=gnu++2b -MD -MT CMakeFiles/cpp23.dir/main.cpp.o -MF CMakeFiles/cpp23.dir/main.cpp.o.d -o CMakeFiles/cpp23.dir/main.cpp.o -c /data/runge_data/Projects/clion_proj/cpp23/main.cpp
1. <eof> parser at end of file
2. Per-file LLVM IR generation
3. /usr/local/include/c++/v1/ostream:750:1: Generating code for declaration 'std::__put_character_sequence'
4. /usr/local/include/c++/v1/ostream:755:5: LLVM IR generation of compound statement ('{}')
#0 0x00007ff2020b24f9 (/usr/bin/../lib/libLLVM-16.so+0xcb24f9)
#1 0x00007ff20206761f llvm::sys::RunSignalHandlers() (/usr/bin/../lib/libLLVM-16.so+0xc6761f)
#2 0x00007ff201ff44c8 (/usr/bin/../lib/libLLVM-16.so+0xbf44c8)
#3 0x00007ff20bbd7a00 (/usr/bin/../lib/libc.so.6+0x38a00)
#4 0x00007ff20bc2764c (/usr/bin/../lib/libc.so.6+0x8864c)
#5 0x00007ff20bbd7958 raise (/usr/bin/../lib/libc.so.6+0x38958)
#6 0x00007ff20bbc153d abort (/usr/bin/../lib/libc.so.6+0x2253d)
#7 0x00007ff20bc1b7ee (/usr/bin/../lib/libc.so.6+0x7c7ee)
#8 0x00007ff20bc313dc (/usr/bin/../lib/libc.so.6+0x923dc)
#9 0x00007ff20bc3322c (/usr/bin/../lib/libc.so.6+0x9422c)
#10 0x00007ff20bc35ba3 cfree (/usr/bin/../lib/libc.so.6+0x96ba3)
#11 0x00007ff2021efa95 llvm::LandingPadInst::addClause(llvm::Constant*) (/usr/bin/../lib/libLLVM-16.so+0xdefa95)
#12 0x00007ff20a0274df (/usr/bin/../lib/libclang-cpp.so.16+0x18274df)
#13 0x00007ff20a027768 clang::CodeGen::CodeGenFunction::getInvokeDestImpl() (/usr/bin/../lib/libclang-cpp.so.16+0x1827768)
#14 0x00007ff209fcbad7 clang::CodeGen::CodeGenFunction::EmitCall(clang::CodeGen::CGFunctionInfo const&, clang::CodeGen::CGCallee const&, clang::CodeGen::ReturnValueSlot, clang::CodeGen::CallArgList const&, llvm::CallBase**, bool, clang::SourceLocation) (/usr/bin/../lib/libclang-cpp.so.16+0x17cbad7)
#15 0x00007ff209fd12f6 clang::CodeGen::CodeGenFunction::EmitCXXConstructorCall(clang::CXXConstructorDecl const*, clang::CXXCtorType, bool, bool, clang::CodeGen::Address, clang::CodeGen::CallArgList&, clang::CodeGen::AggValueSlot::Overlap_t, clang::SourceLocation, bool) (/usr/bin/../lib/libclang-cpp.so.16+0x17d12f6)
#16 0x00007ff209fd1b49 clang::CodeGen::CodeGenFunction::EmitCXXConstructorCall(clang::CXXConstructorDecl const*, clang::CXXCtorType, bool, bool, clang::CodeGen::AggValueSlot, clang::CXXConstructExpr const*) (/usr/bin/../lib/libclang-cpp.so.16+0x17d1b49)
#17 0x00007ff20a05eb5f (/usr/bin/../lib/libclang-cpp.so.16+0x185eb5f)
#18 0x00007ff20a048632 clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const*, clang::CodeGen::AggValueSlot) (/usr/bin/../lib/libclang-cpp.so.16+0x1848632)
#19 0x00007ff20a0186c5 clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*, clang::ValueDecl const*, clang::CodeGen::LValue, bool) (/usr/bin/../lib/libclang-cpp.so.16+0x18186c5)
#20 0x00007ff20a018c1a clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission const&) (/usr/bin/../lib/libclang-cpp.so.16+0x1818c1a)
#21 0x00007ff20a018fd9 clang::CodeGen::CodeGenFunction::EmitAutoVarDecl(clang::VarDecl const&) (/usr/bin/../lib/libclang-cpp.so.16+0x1818fd9)
#22 0x00007ff20a0191d2 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) (/usr/bin/../lib/libclang-cpp.so.16+0x18191d2)
#23 0x00007ff20a163db7 clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) (/usr/bin/../lib/libclang-cpp.so.16+0x1963db7)
#24 0x00007ff20a180ee5 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/usr/bin/../lib/libclang-cpp.so.16+0x1980ee5)
#25 0x00007ff20a17bf22 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/usr/bin/../lib/libclang-cpp.so.16+0x197bf22)
#26 0x00007ff20a17cf69 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/usr/bin/../lib/libclang-cpp.so.16+0x197cf69)
#27 0x00007ff20a17d258 clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/usr/bin/../lib/libclang-cpp.so.16+0x197d258)
#28 0x00007ff20a180ecf clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/usr/bin/../lib/libclang-cpp.so.16+0x1980ecf)
#29 0x00007ff20a17bf22 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/usr/bin/../lib/libclang-cpp.so.16+0x197bf22)
#30 0x00007ff20a02f037 clang::CodeGen::CodeGenFunction::EmitCXXTryStmt(clang::CXXTryStmt const&) (/usr/bin/../lib/libclang-cpp.so.16+0x182f037)
#31 0x00007ff20a17cf69 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/usr/bin/../lib/libclang-cpp.so.16+0x197cf69)
#32 0x00007ff20a1d0c17 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/usr/bin/../lib/libclang-cpp.so.16+0x19d0c17)
#33 0x00007ff20a1ded4e clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/usr/bin/../lib/libclang-cpp.so.16+0x19ded4e)
#34 0x00007ff20a20e37f clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/bin/../lib/libclang-cpp.so.16+0x1a0e37f)
#35 0x00007ff20a20c0d4 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/bin/../lib/libclang-cpp.so.16+0x1a0c0d4)
#36 0x00007ff20a20de2d clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/bin/../lib/libclang-cpp.so.16+0x1a0de2d)
#37 0x00007ff20a20de45 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/bin/../lib/libclang-cpp.so.16+0x1a0de45)
#38 0x00007ff20a21493e clang::CodeGen::CodeGenModule::Release() (/usr/bin/../lib/libclang-cpp.so.16+0x1a1493e)
#39 0x00007ff20a278dca (/usr/bin/../lib/libclang-cpp.so.16+0x1a78dca)
#40 0x00007ff20a1c19d3 (/usr/bin/../lib/libclang-cpp.so.16+0x19c19d3)
#41 0x00007ff2090b8410 clang::ParseAST(clang::Sema&, bool, bool) (/usr/bin/../lib/libclang-cpp.so.16+0x8b8410)
#42 0x00007ff20a87c2f9 clang::FrontendAction::Execute() (/usr/bin/../lib/libclang-cpp.so.16+0x207c2f9)
#43 0x00007ff20a81cfcf clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/bin/../lib/libclang-cpp.so.16+0x201cfcf)
#44 0x00007ff20a8e4672 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/bin/../lib/libclang-cpp.so.16+0x20e4672)
#45 0x0000557d173f33b0 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang+++0x103b0)
#46 0x0000557d173f75b3 (/usr/bin/clang+++0x145b3)
#47 0x00007ff20a574699 (/usr/bin/../lib/libclang-cpp.so.16+0x1d74699)
#48 0x00007ff201fc6db9 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/bin/../lib/libLLVM-16.so+0xbc6db9)
#49 0x00007ff20a57bc2f (/usr/bin/../lib/libclang-cpp.so.16+0x1d7bc2f)
#50 0x00007ff20a567a0e clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/bin/../lib/libclang-cpp.so.16+0x1d67a0e)
#51 0x00007ff20a567dcd clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/usr/bin/../lib/libclang-cpp.so.16+0x1d67dcd)
#52 0x00007ff20a56df9c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/usr/bin/../lib/libclang-cpp.so.16+0x1d6df9c)
#53 0x0000557d173fa7ed clang_main(int, char**) (/usr/bin/clang+++0x177ed)
#54 0x00007ff20bbc2290 (/usr/bin/../lib/libc.so.6+0x23290)
#55 0x00007ff20bbc234a __libc_start_main (/usr/bin/../lib/libc.so.6+0x2334a)
#56 0x0000557d173efcf5 _start (/usr/bin/clang+++0xccf5)
clang-16: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 16.0.0 (/startdir/llvm-project f33173acd6875fa86448bb6d91bdac8f1296510a)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-16: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-16: note: diagnostic msg: /tmp/main-1234e2.cpp
clang-16: note: diagnostic msg: /tmp/main-1234e2.sh
clang-16: note: diagnostic msg:
```
where .cpp is just a hello world:
```
#include <iostream>
#include <ranges>
int main() {
std::cout << "hello, world" << std::endl;
}
```
and compile commands is:
```
clang++ -nostdinc++ -nostdlib++ -isystem /usr/local/include/c++/v1 -L /usr/local/lib -lc++ -g -std=gnu++2b -c main.cpp -o main
```
[main-1234e2.cpp.txt](https://github.com/llvm/llvm-project/files/9929635/main-1234e2.cpp.txt)
[main-1234e2.sh.txt](https://github.com/llvm/llvm-project/files/9929637/main-1234e2.sh.txt)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzlW113mzwS_jXOjY59QHxf5MJxkr7Zk2564mzbOx8hCZu3GLwC0uTf70hgm8H5sEl3t7tvD6UYpEfPzGhGA5rGhXg-H5O7OcnSvH4i_sSa-OQp9Be-S0bW5ciajgnPWL4c0Qs4iK1bWCRxHDtwGBd-GHgJC33XDePYF5EdC8bDxKaR79kWG9FwRKMtUJbGHONYVmxFLIjtkMVNq-ZshiS8WG8ylublyJl2n458qz32jce2D63IT6byFNjC5ThrB9M_RjQACX9IBRckzTd1Req8LqUgI-9i_K25HsOAa5aLMTSVY6aW9Vrm1ci7fHOcbbstoKhV2pJPM1alRd4SGN-O6HVdAoXrrOAs0_-msSZ0PIdESdkqFUDT_JFlq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