<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 fails to emit thinlto file with "Unknown constant!" "UNREACHABLE executed at llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:2611""
href="https://bugs.llvm.org/show_bug.cgi?id=48841">48841</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang fails to emit thinlto file with "Unknown constant!" "UNREACHABLE executed at llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:2611"
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>hans@chromium.org
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>We hit this in Chromium (<a href="https://crbug.com/1169051">https://crbug.com/1169051</a>)
To reproduce: (Using LLVM 8dddcc762dd98d53b9406b36e92f62502834187c)
$ cat /tmp/a.ii
inline namespace a {
template <class b, class... c> void d(c...) { b(c()...); }
class f {
public:
f(const char *);
};
} // namespace a
template <typename e> void g(e);
class h {
public:
h(f, f);
};
class i {
static const char p[];
class k {
using j = i;
void l();
};
i();
int m_fn1() const;
};
template <typename m, typename n, n (m::*)() const> class o : h { using h::h;
};
i::i() { g(&i::m_fn1); }
const char i::p[] = "";
void i::k::l() { d<o<j, decltype(0), &j::m_fn1>>("", ""); }
$ build.release/bin/clang.bad -cc1 -triple x86_64-unknown-linux-gnu
-emit-llvm-bc -flto=thin -std=c++14 -fsanitize=cfi-icall,cfi-vcall
-debug-info-kind=constructor -fsplit-lto-unit /tmp/a.ii
declare void @_ZNK1i5m_fn1Ev()
Unknown constant!
UNREACHABLE executed at
/work/llvm.monorepo/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:2611!
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: build.release/bin/clang.bad -cc1 -triple
x86_64-unknown-linux-gnu -emit-llvm-bc -flto=thin -std=c++14
-fsanitize=cfi-icall,cfi-vcall -debug-info-kind=constructor -fsplit-lto-unit
/tmp/a.ii
1. <eof> parser at end of file
2. Per-module optimization passes
3. Running pass 'ThinLTO Bitcode Writer' on module '/tmp/a.ii'.
#0 0x00000000029e6d23 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(build.release/bin/clang.bad+0x29e6d23)
#1 0x00000000029e4b5e llvm::sys::RunSignalHandlers()
(build.release/bin/clang.bad+0x29e4b5e)
#2 0x00000000029e71e5 SignalHandler(int)
(build.release/bin/clang.bad+0x29e71e5)
#3 0x00007fb2e9812140 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x14140)
#4 0x00007fb2e92eac81 raise ./signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#5 0x00007fb2e92d4537 abort ./stdlib/abort.c:81:7
#6 0x000000000296ba61 (build.release/bin/clang.bad+0x296ba61)
#7 0x0000000003aca530 (anonymous
namespace)::ModuleBitcodeWriter::writeConstants(unsigned int, unsigned int,
bool) (build.release/bin/clang.bad+0x3aca530)
#8 0x0000000003ab201c (anonymous namespace)::ModuleBitcodeWriter::write()
(build.release/bin/clang.bad+0x3ab201c)
#9 0x0000000003aaec0e llvm::BitcodeWriter::writeModule(llvm::Module const&,
bool, llvm::ModuleSummaryIndex const*, bool, std::array<unsigned int, 5ul>*)
(build.release/bin/clang.bad+0x3aaec0e)
#10 0x0000000003a2b6a6 (anonymous
namespace)::writeThinLTOBitcode(llvm::raw_ostream&, llvm::raw_ostream*,
llvm::function_ref<llvm::AAResults& (llvm::Function&)>, llvm::Module&,
llvm::ModuleSummaryIndex const*) (build.release/bin/clang.bad+0x3a2b6a6)
#11 0x0000000003a2c025 (anonymous
namespace)::WriteThinLTOBitcode::runOnModule(llvm::Module&)
(build.release/bin/clang.bad+0x3a2c025)
#12 0x000000000223dffc llvm::legacy::PassManagerImpl::run(llvm::Module&)
(build.release/bin/clang.bad+0x223dffc)
#13 0x0000000002c38947 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(build.release/bin/clang.bad+0x2c38947)
#14 0x0000000003906fcc
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(build.release/bin/clang.bad+0x3906fcc)
#15 0x000000000427aac4 clang::ParseAST(clang::Sema&, bool, bool)
(build.release/bin/clang.bad+0x427aac4)
#16 0x00000000032671b0 clang::FrontendAction::Execute()
(build.release/bin/clang.bad+0x32671b0)
#17 0x00000000031e710a
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(build.release/bin/clang.bad+0x31e710a)
#18 0x0000000003316974
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(build.release/bin/clang.bad+0x3316974)
#19 0x00000000009c1537 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (build.release/bin/clang.bad+0x9c1537)
#20 0x00000000009bf11c ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(build.release/bin/clang.bad+0x9bf11c)
#21 0x00000000009bedad main (build.release/bin/clang.bad+0x9bedad)
#22 0x00007fb2e92d5d0a __libc_start_main ./csu/../csu/libc-start.c:308:16
#23 0x00000000009bbdca _start (build.release/bin/clang.bad+0x9bbdca)
Aborted</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>