[llvm-bugs] [Bug 45964] New: clang crash in clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)

via llvm-bugs llvm-bugs at lists.llvm.org
Sun May 17 22:49:38 PDT 2020


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

            Bug ID: 45964
           Summary: clang crash in
                    clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang:
                    :Expr const*, bool)
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: robert at debian.org
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Created attachment 23501
  --> https://bugs.llvm.org/attachment.cgi?id=23501&action=edit
crash-89a527.cpp and crash-89a527.sh files

The following code:

struct A {
  using B = void (*)();
  B c;
};
class D {
  static const A e[];
};
class F {
public:
  struct G {
    unsigned h[2];
  };
  template <typename I> I get();
};
template <int> void j();
template <typename = void> struct K;
template <> struct K<> {
  template <int l> static void m() {
    F n;
    auto o = n.get<F::G>();
    auto [p, q] = o.h;
    j<l>();
  }
};
const A D::e[]{K<>::m<0>};

makes clang to crash with:

Stack dump:
0.      Program arguments: clang++-10 --std=c++17 -c crash.cpp 
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
3.      crash.cpp:18:32: Generating code for declaration 'K<void>::m'
/usr/lib/x86_64-linux-gnu/libLLVM-10.so.1(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x1f)[0x7f00a985890f]
/usr/lib/x86_64-linux-gnu/libLLVM-10.so.1(_ZN4llvm3sys17RunSignalHandlersEv+0x50)[0x7f00a9856bc0]
/usr/lib/x86_64-linux-gnu/libLLVM-10.so.1(_ZN4llvm3sys15CleanupOnSignalEm+0xdd)[0x7f00a985805d]
/usr/lib/x86_64-linux-gnu/libLLVM-10.so.1(+0x9b43f0)[0x7f00a97aa3f0]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x14110)[0x7f00b016a110]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(+0x16388d9)[0x7f00aebc98d9]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZN5clang7CodeGen15CodeGenFunction14EmitScalarExprEPKNS_4ExprEb+0x4f)[0x7f00aebba8af]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZN5clang7CodeGen15CodeGenFunction11EmitAnyExprEPKNS_4ExprENS0_12AggValueSlotEb+0x38)[0x7f00aeb79e98]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZN5clang7CodeGen15CodeGenFunction15EmitIgnoredExprEPKNS_4ExprE+0x59)[0x7f00aeb79e49]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZN5clang7CodeGen15CodeGenFunction8EmitStmtEPKNS_4StmtEN4llvm8ArrayRefIPKNS_4AttrEEE+0x194)[0x7f00aecadb14]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZN5clang7CodeGen15CodeGenFunction28EmitCompoundStmtWithoutScopeERKNS_12CompoundStmtEbNS0_12AggValueSlotE+0x8c)[0x7f00aecb784c]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZN5clang7CodeGen15CodeGenFunction16EmitFunctionBodyEPKNS_4StmtE+0x112)[0x7f00aecf91b2]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZN5clang7CodeGen15CodeGenFunction12GenerateCodeENS_10GlobalDeclEPN4llvm8FunctionERKNS0_14CGFunctionInfoE+0x2cf)[0x7f00aecf9a0f]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZN5clang7CodeGen13CodeGenModule28EmitGlobalFunctionDefinitionENS_10GlobalDeclEPN4llvm11GlobalValueE+0x14d)[0x7f00aed1124d]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZN5clang7CodeGen13CodeGenModule20EmitGlobalDefinitionENS_10GlobalDeclEPN4llvm11GlobalValueE+0x1d3)[0x7f00aed0b3e3]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZN5clang7CodeGen13CodeGenModule12EmitDeferredEv+0x91)[0x7f00aed02501]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZN5clang7CodeGen13CodeGenModule12EmitDeferredEv+0xad)[0x7f00aed0251d]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZN5clang7CodeGen13CodeGenModule7ReleaseEv+0x17)[0x7f00aed01887]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(+0x17f2434)[0x7f00aed83434]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(+0x17600ad)[0x7f00aecf10ad]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZN5clang8ParseASTERNS_4SemaEbb+0x283)[0x7f00adedf163]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZN5clang14FrontendAction7ExecuteEv+0x48)[0x7f00af3553a8]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x621)[0x7f00af30ddf1]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZN5clang25ExecuteCompilerInvocationEPNS_16CompilerInstanceE+0x66f)[0x7f00af3b92ff]
clang++-10(_Z8cc1_mainN4llvm8ArrayRefIPKcEES2_Pv+0x98d)[0x412e3d]
clang++-10[0x411151]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(+0x1acde42)[0x7f00af05ee42]
/usr/lib/x86_64-linux-gnu/libLLVM-10.so.1(_ZN4llvm20CrashRecoveryContext9RunSafelyENS_12function_refIFvvEEE+0xd7)[0x7f00a97aa1f7]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZNK5clang6driver10CC1Command7ExecuteEN4llvm8ArrayRefINS2_8OptionalINS2_9StringRefEEEEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb+0x13f)[0x7f00af05e37f]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZNK5clang6driver11Compilation14ExecuteCommandERKNS0_7CommandERPS3_+0x2df)[0x7f00af036a7f]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZNK5clang6driver11Compilation11ExecuteJobsERKNS0_7JobListERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x7a)[0x7f00af036c2a]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.10(_ZN5clang6driver6Driver18ExecuteCompilationERNS0_11CompilationERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0xdc)[0x7f00af049e8c]
clang++-10(main+0x259f)[0x410bcf]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb)[0x7f00a892be0b]
clang++-10(_start+0x2a)[0x40e36a]
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 10.0.0-4 
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/user/1000/crash-89a527.cpp
clang: note: diagnostic msg: /tmp/user/1000/crash-89a527.sh
clang: note: diagnostic msg: 

********************

-- 
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/20200518/86e9b490/attachment-0001.html>


More information about the llvm-bugs mailing list