[llvm-bugs] [Bug 48841] New: clang fails to emit thinlto file with "Unknown constant!" "UNREACHABLE executed at llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:2611"

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 22 01:34:07 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=48841

            Bug ID: 48841
           Summary: clang fails to emit thinlto file with "Unknown
                    constant!" "UNREACHABLE executed at
                    llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:2611"
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: hans at chromium.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

We hit this in Chromium (https://crbug.com/1169051)

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 https://bugs.llvm.org/ 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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210122/f4e8f37f/attachment.html>


More information about the llvm-bugs mailing list