[llvm-bugs] [Bug 48128] New: clang++ fails create local function inside local structure in template function

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 9 19:19:39 PST 2020


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

            Bug ID: 48128
           Summary: clang++ fails create local function inside local
                    structure in template function
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: erstrauss at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

The the program below creates a local function inside a Local structure, and
adds the
local function address into the .init_array section in order to call that local
function at process start.
The localFunc template function is using a source_location const static
variable as template parameter.
See below output of the running program when the template instantiation is only
requested from inside simple function.
The clang++ crash happens when this template is called from within a template.

----------------
$ cat init_array3.cpp 
#include <experimental/source_location>
#include <iostream>

using namespace std::experimental;

template<const source_location& X>
void localFunc(const char* name)
{
    static int                     count{0};
    volatile ::std::ios_base::Init dummy{};
    std::cout << "post-main X: " << name << " " << X.file_name() << " " <<
X.line()
              << " &zount: " << (void*)&count << " count: " << (++count) << " "
              << __PRETTY_FUNCTION__ << std::endl;

    struct Local
    {
        static void init()
        {
            volatile ::std::ios_base::Init dummy{};
            std::cout << "pre-main init from localFunc: " << X.file_name() << "
"
                      << X.line() << " &count: " << (void*)&count
                      << " count: " << (++count) << " " << __PRETTY_FUNCTION__
                      << std::endl;
        }
    };

    static void* volatile initp
        __attribute__((__used__, section(".init_array"))){(void*)&Local::init};
}

#define LOCAL_FUNC(NAME)                                      \
    do                                                        \
    {                                                         \
        constexpr static auto s = source_location::current(); \
        localFunc<s>((const char*)&(NAME)[0]);                \
    } while (0)

void okFunc() { LOCAL_FUNC("X1"); }

template<typename T>
void funcA(T)
{
    LOCAL_FUNC("XT2");
}

int main()
{
    std::cout << "main() started" << std::endl;
    okFunc();
    funcA<int>(1);  //**** the template creates local function for the template
instantiation.
    return 0;
}

----------------

if the //**** line is commented out, the compiled program works and output the
following:

----------------
$ ./init_array3
pre-main init from localFunc: init_array3.cpp 38 &count: 0x404198 count: 1
static void localFunc(const char *)::Local::init()
main() started
post-main X: X1 init_array3.cpp 38 &zount: 0x404198 count: 2 void
localFunc(const char *) [X = s]

----------------

$ clang++ -std=c++20 -v init_array3.cpp -o init_array3
clang version 11.0.0 (Fedora 11.0.0-1.fc33)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/10
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/10
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
 "/usr/bin/clang-11" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj
-mrelax-all -disable-free -disable-llvm-verifier -discard-value-names
-main-file-name init_array3.cpp -mrelocation-model static -mframe-pointer=all
-fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -v
-resource-dir /usr/lib64/clang/11.0.0 -internal-isystem
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10
-internal-isystem
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux
-internal-isystem
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/lib64/clang/11.0.0/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++20 -fdeprecated-macro
-fdebug-compilation-dir /home/erez/projects/c++-experiments -ferror-limit 19
-fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics
-faddrsig -o /tmp/init_array3-66098d.o -x c++ init_array3.cpp
clang -cc1 version 11.0.0 based upon LLVM 11.0.0 default target
x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10

/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux
 /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward
 /usr/local/include
 /usr/lib64/clang/11.0.0/include
 /usr/include
End of search list.
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: /usr/bin/clang-11 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name init_array3.cpp
-mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math
-mconstructor-aliases -munwind-tables -target-cpu x86-64
-fno-split-dwarf-inlining -debugger-tuning=gdb -v -resource-dir
/usr/lib64/clang/11.0.0 -internal-isystem
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10
-internal-isystem
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux
-internal-isystem
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/lib64/clang/11.0.0/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++20 -fdeprecated-macro
-fdebug-compilation-dir /home/erez/projects/c++-experiments -ferror-limit 19
-fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics
-faddrsig -o /tmp/init_array3-66098d.o -x c++ init_array3.cpp 
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
3.      init_array3.cpp:7:6: Generating code for declaration 'localFunc'
  #0 0x00007f72414ae27a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/lib64/libLLVM-11.so+0xa8b27a)
  #1 0x00007f72414ac4e4 llvm::sys::RunSignalHandlers()
(/lib64/libLLVM-11.so+0xa894e4)
  #2 0x00007f72414ac676 (/lib64/libLLVM-11.so+0xa89676)
  #3 0x00007f7240691c50 __restore_rt (/lib64/libc.so.6+0x3dc50)
  #4 0x00007f724720b9b4 (/lib64/libclang-cpp.so.11+0x14f09b4)
  #5 0x00007f724720d56d
clang::CodeGen::CodeGenTypes::GetFunctionType(clang::CodeGen::CGFunctionInfo
const&) (/lib64/libclang-cpp.so.11+0x14f256d)
  #6 0x00007f7247436f21
clang::CodeGen::CodeGenModule::GetAddrOfGlobal(clang::GlobalDecl,
clang::CodeGen::ForDefinition_t) (/lib64/libclang-cpp.so.11+0x171bf21)
  #7 0x00007f7247261d74
clang::CodeGen::CodeGenModule::getOrCreateStaticVarDecl(clang::VarDecl const&,
llvm::GlobalValue::LinkageTypes) (/lib64/libclang-cpp.so.11+0x1546d74)
  #8 0x00007f7247294328
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*)
(/lib64/libclang-cpp.so.11+0x1579328)
  #9 0x00007f7247292abd clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/lib64/libclang-cpp.so.11+0x1577abd)
 #10 0x00007f7247292714 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/lib64/libclang-cpp.so.11+0x1577714)
 #11 0x00007f72472994a6
clang::CodeGen::CodeGenFunction::EmitCXXMemberOrOperatorMemberCallExpr(clang::CallExpr
const*, clang::CXXMethodDecl const*, clang::CodeGen::ReturnValueSlot, bool,
clang::NestedNameSpecifier*, bool, clang::Expr const*)
(/lib64/libclang-cpp.so.11+0x157e4a6)
 #12 0x00007f724729ac0b
clang::CodeGen::CodeGenFunction::EmitCXXMemberCallExpr(clang::CXXMemberCallExpr
const*, clang::CodeGen::ReturnValueSlot) (/lib64/libclang-cpp.so.11+0x157fc0b)
 #13 0x00007f72472dbf1a (/lib64/libclang-cpp.so.11+0x15c0f1a)
 #14 0x00007f72472dba42
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/lib64/libclang-cpp.so.11+0x15c0a42)
 #15 0x00007f724727215f
clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*,
clang::CodeGen::AggValueSlot, bool) (/lib64/libclang-cpp.so.11+0x155715f)
 #16 0x00007f724727234f
clang::CodeGen::CodeGenFunction::EmitAnyExprToTemp(clang::Expr const*)
(/lib64/libclang-cpp.so.11+0x155734f)
 #17 0x00007f724721c797
clang::CodeGen::CodeGenFunction::EmitCallArg(clang::CodeGen::CallArgList&,
clang::Expr const*, clang::QualType) (/lib64/libclang-cpp.so.11+0x1501797)
 #18 0x00007f7247230fce
clang::CodeGen::CodeGenFunction::EmitCallArgs(clang::CodeGen::CallArgList&,
llvm::ArrayRef<clang::QualType>,
llvm::iterator_range<clang::Stmt::CastIterator<clang::Expr, clang::Expr const*
const, clang::Stmt const* const> >,
clang::CodeGen::CodeGenFunction::AbstractCallee, unsigned int,
clang::CodeGen::CodeGenFunction::EvaluationOrder)
(/lib64/libclang-cpp.so.11+0x1515fce)
 #19 0x00007f7247167172 (/lib64/libclang-cpp.so.11+0x144c172)
 #20 0x00007f724728f7ae
clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType,
clang::CodeGen::CGCallee const&, clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot, llvm::Value*)
(/lib64/libclang-cpp.so.11+0x15747ae)
 #21 0x00007f724729aff9
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot) (/lib64/libclang-cpp.so.11+0x157fff9)
 #22 0x00007f724729b0d3
clang::CodeGen::CodeGenFunction::EmitCallExprLValue(clang::CallExpr const*)
(/lib64/libclang-cpp.so.11+0x15800d3)
 #23 0x00007f7247292792 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/lib64/libclang-cpp.so.11+0x1577792)
 #24 0x00007f724726858e
clang::CodeGen::CodeGenFunction::EmitReferenceBindingToExpr(clang::Expr const*)
(/lib64/libclang-cpp.so.11+0x154d58e)
 #25 0x00007f724721ce3b
clang::CodeGen::CodeGenFunction::EmitCallArg(clang::CodeGen::CallArgList&,
clang::Expr const*, clang::QualType) (/lib64/libclang-cpp.so.11+0x1501e3b)
 #26 0x00007f7247230fce
clang::CodeGen::CodeGenFunction::EmitCallArgs(clang::CodeGen::CallArgList&,
llvm::ArrayRef<clang::QualType>,
llvm::iterator_range<clang::Stmt::CastIterator<clang::Expr, clang::Expr const*
const, clang::Stmt const* const> >,
clang::CodeGen::CodeGenFunction::AbstractCallee, unsigned int,
clang::CodeGen::CodeGenFunction::EvaluationOrder)
(/lib64/libclang-cpp.so.11+0x1515fce)
 #27 0x00007f7247167172 (/lib64/libclang-cpp.so.11+0x144c172)
 #28 0x00007f724728f7ae
clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType,
clang::CodeGen::CGCallee const&, clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot, llvm::Value*)
(/lib64/libclang-cpp.so.11+0x15747ae)
 #29 0x00007f724729aff9
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot) (/lib64/libclang-cpp.so.11+0x157fff9)
 #30 0x00007f724729b0d3
clang::CodeGen::CodeGenFunction::EmitCallExprLValue(clang::CallExpr const*)
(/lib64/libclang-cpp.so.11+0x15800d3)
 #31 0x00007f7247292792 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/lib64/libclang-cpp.so.11+0x1577792)
 #32 0x00007f72472994a6
clang::CodeGen::CodeGenFunction::EmitCXXMemberOrOperatorMemberCallExpr(clang::CallExpr
const*, clang::CXXMethodDecl const*, clang::CodeGen::ReturnValueSlot, bool,
clang::NestedNameSpecifier*, bool, clang::Expr const*)
(/lib64/libclang-cpp.so.11+0x157e4a6)
 #33 0x00007f724729a663
clang::CodeGen::CodeGenFunction::EmitCXXOperatorMemberCallExpr(clang::CXXOperatorCallExpr
const*, clang::CXXMethodDecl const*, clang::CodeGen::ReturnValueSlot)
(/lib64/libclang-cpp.so.11+0x157f663)
 #34 0x00007f724729b0d3
clang::CodeGen::CodeGenFunction::EmitCallExprLValue(clang::CallExpr const*)
(/lib64/libclang-cpp.so.11+0x15800d3)
 #35 0x00007f7247292792 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/lib64/libclang-cpp.so.11+0x1577792)
 #36 0x00007f724726858e
clang::CodeGen::CodeGenFunction::EmitReferenceBindingToExpr(clang::Expr const*)
(/lib64/libclang-cpp.so.11+0x154d58e)
 #37 0x00007f724721ce3b
clang::CodeGen::CodeGenFunction::EmitCallArg(clang::CodeGen::CallArgList&,
clang::Expr const*, clang::QualType) (/lib64/libclang-cpp.so.11+0x1501e3b)
 #38 0x00007f7247230fce
clang::CodeGen::CodeGenFunction::EmitCallArgs(clang::CodeGen::CallArgList&,
llvm::ArrayRef<clang::QualType>,
llvm::iterator_range<clang::Stmt::CastIterator<clang::Expr, clang::Expr const*
const, clang::Stmt const* const> >,
clang::CodeGen::CodeGenFunction::AbstractCallee, unsigned int,
clang::CodeGen::CodeGenFunction::EvaluationOrder)
(/lib64/libclang-cpp.so.11+0x1515fce)
 #39 0x00007f7247167172 (/lib64/libclang-cpp.so.11+0x144c172)
 #40 0x00007f724728f7ae
clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType,
clang::CodeGen::CGCallee const&, clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot, llvm::Value*)
(/lib64/libclang-cpp.so.11+0x15747ae)
 #41 0x00007f724729aff9
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot) (/lib64/libclang-cpp.so.11+0x157fff9)
 #42 0x00007f724729b0d3
clang::CodeGen::CodeGenFunction::EmitCallExprLValue(clang::CallExpr const*)
(/lib64/libclang-cpp.so.11+0x15800d3)
 #43 0x00007f7247292792 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/lib64/libclang-cpp.so.11+0x1577792)
 #44 0x00007f72472994a6
clang::CodeGen::CodeGenFunction::EmitCXXMemberOrOperatorMemberCallExpr(clang::CallExpr
const*, clang::CXXMethodDecl const*, clang::CodeGen::ReturnValueSlot, bool,
clang::NestedNameSpecifier*, bool, clang::Expr const*)
(/lib64/libclang-cpp.so.11+0x157e4a6)
 #45 0x00007f724729a663
clang::CodeGen::CodeGenFunction::EmitCXXOperatorMemberCallExpr(clang::CXXOperatorCallExpr
const*, clang::CXXMethodDecl const*, clang::CodeGen::ReturnValueSlot)
(/lib64/libclang-cpp.so.11+0x157f663)
 #46 0x00007f724729b0d3
clang::CodeGen::CodeGenFunction::EmitCallExprLValue(clang::CallExpr const*)
(/lib64/libclang-cpp.so.11+0x15800d3)
 #47 0x00007f7247292792 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/lib64/libclang-cpp.so.11+0x1577792)
 #48 0x00007f724726858e
clang::CodeGen::CodeGenFunction::EmitReferenceBindingToExpr(clang::Expr const*)
(/lib64/libclang-cpp.so.11+0x154d58e)
 #49 0x00007f724721ce3b
clang::CodeGen::CodeGenFunction::EmitCallArg(clang::CodeGen::CallArgList&,
clang::Expr const*, clang::QualType) (/lib64/libclang-cpp.so.11+0x1501e3b)
 #50 0x00007f7247230fce
clang::CodeGen::CodeGenFunction::EmitCallArgs(clang::CodeGen::CallArgList&,
llvm::ArrayRef<clang::QualType>,
llvm::iterator_range<clang::Stmt::CastIterator<clang::Expr, clang::Expr const*
const, clang::Stmt const* const> >,
clang::CodeGen::CodeGenFunction::AbstractCallee, unsigned int,
clang::CodeGen::CodeGenFunction::EvaluationOrder)
(/lib64/libclang-cpp.so.11+0x1515fce)
 #51 0x00007f7247167172 (/lib64/libclang-cpp.so.11+0x144c172)
 #52 0x00007f724728f7ae
clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType,
clang::CodeGen::CGCallee const&, clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot, llvm::Value*)
(/lib64/libclang-cpp.so.11+0x15747ae)
 #53 0x00007f724729aff9
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot) (/lib64/libclang-cpp.so.11+0x157fff9)
 #54 0x00007f724729b0d3
clang::CodeGen::CodeGenFunction::EmitCallExprLValue(clang::CallExpr const*)
(/lib64/libclang-cpp.so.11+0x15800d3)
 #55 0x00007f7247292792 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/lib64/libclang-cpp.so.11+0x1577792)
 #56 0x00007f72472994a6
clang::CodeGen::CodeGenFunction::EmitCXXMemberOrOperatorMemberCallExpr(clang::CallExpr
const*, clang::CXXMethodDecl const*, clang::CodeGen::ReturnValueSlot, bool,
clang::NestedNameSpecifier*, bool, clang::Expr const*)
(/lib64/libclang-cpp.so.11+0x157e4a6)
 #57 0x00007f724729a663
clang::CodeGen::CodeGenFunction::EmitCXXOperatorMemberCallExpr(clang::CXXOperatorCallExpr
const*, clang::CXXMethodDecl const*, clang::CodeGen::ReturnValueSlot)
(/lib64/libclang-cpp.so.11+0x157f663)
 #58 0x00007f724729b0d3
clang::CodeGen::CodeGenFunction::EmitCallExprLValue(clang::CallExpr const*)
(/lib64/libclang-cpp.so.11+0x15800d3)
 #59 0x00007f7247292792 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/lib64/libclang-cpp.so.11+0x1577792)
 #60 0x00007f724726858e
clang::CodeGen::CodeGenFunction::EmitReferenceBindingToExpr(clang::Expr const*)
(/lib64/libclang-cpp.so.11+0x154d58e)
 #61 0x00007f724721ce3b
clang::CodeGen::CodeGenFunction::EmitCallArg(clang::CodeGen::CallArgList&,
clang::Expr const*, clang::QualType) (/lib64/libclang-cpp.so.11+0x1501e3b)
 #62 0x00007f7247230fce
clang::CodeGen::CodeGenFunction::EmitCallArgs(clang::CodeGen::CallArgList&,
llvm::ArrayRef<clang::QualType>,
llvm::iterator_range<clang::Stmt::CastIterator<clang::Expr, clang::Expr const*
const, clang::Stmt const* const> >,
clang::CodeGen::CodeGenFunction::AbstractCallee, unsigned int,
clang::CodeGen::CodeGenFunction::EvaluationOrder)
(/lib64/libclang-cpp.so.11+0x1515fce)
 #63 0x00007f7247167172 (/lib64/libclang-cpp.so.11+0x144c172)
 #64 0x00007f724728f7ae
clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType,
clang::CodeGen::CGCallee const&, clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot, llvm::Value*)
(/lib64/libclang-cpp.so.11+0x15747ae)
 #65 0x00007f724729aff9
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot) (/lib64/libclang-cpp.so.11+0x157fff9)
 #66 0x00007f724729b0d3
clang::CodeGen::CodeGenFunction::EmitCallExprLValue(clang::CallExpr const*)
(/lib64/libclang-cpp.so.11+0x15800d3)
 #67 0x00007f7247292792 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/lib64/libclang-cpp.so.11+0x1577792)
 #68 0x00007f724726858e
clang::CodeGen::CodeGenFunction::EmitReferenceBindingToExpr(clang::Expr const*)
(/lib64/libclang-cpp.so.11+0x154d58e)
 #69 0x00007f724721ce3b
clang::CodeGen::CodeGenFunction::EmitCallArg(clang::CodeGen::CallArgList&,
clang::Expr const*, clang::QualType) (/lib64/libclang-cpp.so.11+0x1501e3b)
 #70 0x00007f7247230fce
clang::CodeGen::CodeGenFunction::EmitCallArgs(clang::CodeGen::CallArgList&,
llvm::ArrayRef<clang::QualType>,
llvm::iterator_range<clang::Stmt::CastIterator<clang::Expr, clang::Expr const*
const, clang::Stmt const* const> >,
clang::CodeGen::CodeGenFunction::AbstractCallee, unsigned int,
clang::CodeGen::CodeGenFunction::EvaluationOrder)
(/lib64/libclang-cpp.so.11+0x1515fce)
 #71 0x00007f7247167172 (/lib64/libclang-cpp.so.11+0x144c172)
 #72 0x00007f724728f7ae
clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType,
clang::CodeGen::CGCallee const&, clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot, llvm::Value*)
(/lib64/libclang-cpp.so.11+0x15747ae)
 #73 0x00007f724729aff9
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot) (/lib64/libclang-cpp.so.11+0x157fff9)
 #74 0x00007f724729b0d3
clang::CodeGen::CodeGenFunction::EmitCallExprLValue(clang::CallExpr const*)
(/lib64/libclang-cpp.so.11+0x15800d3)
 #75 0x00007f7247292792 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/lib64/libclang-cpp.so.11+0x1577792)
 #76 0x00007f72472994a6
clang::CodeGen::CodeGenFunction::EmitCXXMemberOrOperatorMemberCallExpr(clang::CallExpr
const*, clang::CXXMethodDecl const*, clang::CodeGen::ReturnValueSlot, bool,
clang::NestedNameSpecifier*, bool, clang::Expr const*)
(/lib64/libclang-cpp.so.11+0x157e4a6)
 #77 0x00007f724729a663
clang::CodeGen::CodeGenFunction::EmitCXXOperatorMemberCallExpr(clang::CXXOperatorCallExpr
const*, clang::CXXMethodDecl const*, clang::CodeGen::ReturnValueSlot)
(/lib64/libclang-cpp.so.11+0x157f663)
 #78 0x00007f724729b0d3
clang::CodeGen::CodeGenFunction::EmitCallExprLValue(clang::CallExpr const*)
(/lib64/libclang-cpp.so.11+0x15800d3)
 #79 0x00007f7247292792 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/lib64/libclang-cpp.so.11+0x1577792)
 #80 0x00007f724727229b
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*)
(/lib64/libclang-cpp.so.11+0x155729b)
 #81 0x00007f72473c264a clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
(/lib64/libclang-cpp.so.11+0x16a764a)
 #82 0x00007f72473c2de9
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/lib64/libclang-cpp.so.11+0x16a7de9)
 #83 0x00007f724740ae74
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
(/lib64/libclang-cpp.so.11+0x16efe74)
 #84 0x00007f7247420efe
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/lib64/libclang-cpp.so.11+0x1705efe)
 #85 0x00007f7247437f51
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/lib64/libclang-cpp.so.11+0x171cf51)
 #86 0x00007f7247434f65
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/lib64/libclang-cpp.so.11+0x1719f65)
 #87 0x00007f72474370b8 clang::CodeGen::CodeGenModule::EmitDeferred()
(/lib64/libclang-cpp.so.11+0x171c0b8)
 #88 0x00007f72474370d0 clang::CodeGen::CodeGenModule::EmitDeferred()
(/lib64/libclang-cpp.so.11+0x171c0d0)
 #89 0x00007f72474371b6 clang::CodeGen::CodeGenModule::Release()
(/lib64/libclang-cpp.so.11+0x171c1b6)
 #90 0x00007f724748ba6a (/lib64/libclang-cpp.so.11+0x1770a6a)
 #91 0x00007f72473dacfa (/lib64/libclang-cpp.so.11+0x16bfcfa)
 #92 0x00007f7246606a4d clang::ParseAST(clang::Sema&, bool, bool)
(/lib64/libclang-cpp.so.11+0x8eba4d)
 #93 0x00007f72479bafd1 clang::FrontendAction::Execute()
(/lib64/libclang-cpp.so.11+0x1c9ffd1)
 #94 0x00007f724798e4e3
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/lib64/libclang-cpp.so.11+0x1c734e3)
 #95 0x00007f7247a1cb70
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/lib64/libclang-cpp.so.11+0x1d01b70)
 #96 0x0000559ca296cdf0 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/bin/clang-11+0x14df0)
 #97 0x0000559ca296f9e9 (/usr/bin/clang-11+0x179e9)
 #98 0x0000559ca2967918 main (/usr/bin/clang-11+0xf918)
 #99 0x00007f724067c1a2 __libc_start_main (/lib64/libc.so.6+0x281a2)
#100 0x0000559ca296a4ce _start (/usr/bin/clang-11+0x124ce)
clang-11: error: unable to execute command: Segmentation fault (core dumped)
clang-11: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 11.0.0 (Fedora 11.0.0-1.fc33)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-11: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-11: note: diagnostic msg: /tmp/init_array3-3ae193.cpp
clang-11: note: diagnostic msg: /tmp/init_array3-3ae193.sh
clang-11: note: diagnostic msg: 

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


$  cat /tmp/init_array3-3ae193.sh
# Crash reproducer for clang version 11.0.0 (Fedora 11.0.0-1.fc33)
# Driver args: "--driver-mode=g++" "-std=c++20" "-v" "init_array3.cpp" "-o"
"init_array3"
# Original command:  "/usr/bin/clang-11" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-disable-llvm-verifier" "-discard-value-names" "-main-file-name"
"init_array3.cpp" "-mrelocation-model" "static" "-mframe-pointer=all"
"-fmath-errno" "-fno-rounding-math" "-mconstructor-aliases" "-munwind-tables"
"-target-cpu" "x86-64" "-fno-split-dwarf-inlining" "-debugger-tuning=gdb" "-v"
"-resource-dir" "/usr/lib64/clang/11.0.0" "-internal-isystem"
"/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10"
"-internal-isystem"
"/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux"
"-internal-isystem"
"/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/usr/lib64/clang/11.0.0/include" "-internal-externc-isystem" "/include"
"-internal-externc-isystem" "/usr/include" "-std=c++20" "-fdeprecated-macro"
"-fdebug-compilation-dir" "/home/erez/projects/c++-experiments" "-ferror-limit"
"19" "-fgnuc-version=4.2.1" "-fcxx-exceptions" "-fexceptions"
"-fcolor-diagnostics" "-faddrsig" "-o" "/tmp/init_array3-66098d.o" "-x" "c++"
"init_array3.cpp"
 "/usr/bin/clang-11" "-cc1" "-triple" "x86_64-unknown-linux-gnu" "-emit-obj"
"-mrelax-all" "-disable-free" "-disable-llvm-verifier" "-discard-value-names"
"-main-file-name" "init_array3.cpp" "-mrelocation-model" "static"
"-mframe-pointer=all" "-fmath-errno" "-fno-rounding-math"
"-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64"
"-fno-split-dwarf-inlining" "-debugger-tuning=gdb" "-v" "-std=c++20"
"-fdeprecated-macro" "-ferror-limit" "19" "-fgnuc-version=4.2.1"
"-fcxx-exceptions" "-fexceptions" "-fcolor-diagnostics" "-faddrsig" "-x" "c++"
"init_array3-3ae193.cpp"

-- 
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/20201110/dd219ac5/attachment-0001.html>


More information about the llvm-bugs mailing list