<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - clang crashes while using -ast-merge and -emit-pch in some cases"
href="https://bugs.llvm.org/show_bug.cgi?id=47962">47962</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang crashes while using -ast-merge and -emit-pch in some cases
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>0@void.re
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>I've tested clang-6.0, clang-8, clang-10, clang-11 and now trunk, they all
crash on this issue.
$ cat test1.c
#include <stdio.h>
void func1(void)
{
}
$ cat test2.c
void test2(void)
{
}
$ ../clang-12 -emit-ast test1.c
$ ../clang-12 -emit-ast test2.c
$ ../clang-12 -cc1 -ast-merge test1.ast -ast-merge test2.ast /dev/null
-emit-pch -o out.ast
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: ../clang-12 -cc1 -ast-merge test1.ast -ast-merge
test2.ast /dev/null -emit-pch -o out.ast
1. <eof> parser at end of file
#0 0x000055e39a5282ec llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/home/user/git/llvm-project/llvm/lib/Support/Unix/Signals.inc:563:22
#1 0x000055e39a5283a7 PrintStackTraceSignalHandler(void*)
/home/user/git/llvm-project/llvm/lib/Support/Unix/Signals.inc:630:1
#2 0x000055e39a526043 llvm::sys::RunSignalHandlers()
/home/user/git/llvm-project/llvm/lib/Support/Signals.cpp:71:20
#3 0x000055e39a527c39 SignalHandler(int)
/home/user/git/llvm-project/llvm/lib/Support/Unix/Signals.inc:405:1
#4 0x00007f0d9df983c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
#5 0x000055e39a49691e llvm::djbHash(llvm::StringRef, unsigned int)
/home/user/git/llvm-project/llvm/include/llvm/Support/DJB.h:22:22
#6 0x000055e39b4bc418 (anonymous
namespace)::ASTIdentifierTableTrait::ComputeHash(clang::IdentifierInfo const*)
/home/user/git/llvm-project/clang/lib/Serialization/ASTWriter.cpp:3310:3
#7 0x000055e39b4e2bac llvm::OnDiskChainedHashTableGenerator<(anonymous
namespace)::ASTIdentifierTableTrait>::Item::Item(clang::IdentifierInfo*,
unsigned int, (anonymous namespace)::ASTIdentifierTableTrait&)
/home/user/git/llvm-project/llvm/include/llvm/Support/OnDiskHashTable.h:70:77
#8 0x000055e39b4df89f llvm::OnDiskChainedHashTableGenerator<(anonymous
namespace)::ASTIdentifierTableTrait>::insert(clang::IdentifierInfo*, unsigned
int, (anonymous namespace)::ASTIdentifierTableTrait&)
/home/user/git/llvm-project/llvm/include/llvm/Support/OnDiskHashTable.h:130:21
#9 0x000055e39b4bcea7
clang::ASTWriter::WriteIdentifierTable(clang::Preprocessor&,
clang::IdentifierResolver&, bool)
/home/user/git/llvm-project/clang/lib/Serialization/ASTWriter.cpp:3453:29
#10 0x000055e39b4d0c38 clang::ASTWriter::WriteASTCore(clang::Sema&,
llvm::StringRef, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&, clang::Module*)
/home/user/git/llvm-project/clang/lib/Serialization/ASTWriter.cpp:4792:54
#11 0x000055e39b4ce69a clang::ASTWriter::WriteAST(clang::Sema&,
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, clang::Module*, llvm::StringRef, bool, bool)
/home/user/git/llvm-project/clang/lib/Serialization/ASTWriter.cpp:4386:64
#12 0x000055e39b565b48
clang::PCHGenerator::HandleTranslationUnit(clang::ASTContext&)
/home/user/git/llvm-project/clang/lib/Serialization/GeneratePCH.cpp:72:45
#13 0x000055e39b1e0134
clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&)
/home/user/git/llvm-project/clang/lib/Frontend/MultiplexConsumer.cpp:291:25
#14 0x000055e39d705239 clang::ParseAST(clang::Sema&, bool, bool)
/home/user/git/llvm-project/clang/lib/Parse/ParseAST.cpp:178:14
#15 0x000055e39b19d8a3 clang::ASTFrontendAction::ExecuteAction()
/home/user/git/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1056:11
#16 0x000055e39d6928f8 clang::ASTMergeAction::ExecuteAction()
/home/user/git/llvm-project/clang/lib/Frontend/ASTMerge.cpp:80:21
#17 0x000055e39b19d162 clang::FrontendAction::Execute()
/home/user/git/llvm-project/clang/lib/Frontend/FrontendAction.cpp:953:38
#18 0x000055e39b12f613
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/user/git/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:989:42
#19 0x000055e39b334614
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/user/git/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:278:38
#20 0x000055e397671279 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /home/user/git/llvm-project/clang/tools/driver/cc1_main.cpp:240:40
#21 0x000055e397665923 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
/home/user/git/llvm-project/clang/tools/driver/driver.cpp:330:20
#22 0x000055e3976660e9 main
/home/user/git/llvm-project/clang/tools/driver/driver.cpp:407:26
#23 0x00007f0d9da190b3 __libc_start_main
/build/glibc-ZN95T4/glibc-2.31/csu/../csu/libc-start.c:342:3
#24 0x000055e397663fbe _start (../clang-12+0x2b7ffbe)
It does merges everything correctly into 1 ast/pch file when #include <stdio.h>
is excluded from test1.c</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>