Any resolution/discussion on this crash?

On Thu, Sep 5, 2019 at 12:49 PM Erik Pilkington via cfe-commits
<cfe-commits@lists.llvm.org> wrote:
>
> Hi Alexandre,
>
> Looks like this commit is causing crashes on darwin, can you take a look 
> please? Here is a failing bot: 
> http://lab.llvm.org:8080/green/job/clang-stage1-RA/1671/
>
> Thanks!
> Erik
>
> On Thu, Sep 5, 2019 at 11:23 AM Alexandre Ganea via cfe-commits 
> <cfe-commits@lists.llvm.org> wrote:
>>
>> Author: aganea
>> Date: Thu Sep  5 08:24:49 2019
>> New Revision: 371080
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=371080&view=rev
>> Log:
>> [DebugInfo] Add debug location to stubs generated by CGDeclCXX and mark them 
>> as artificial
>>
>> Differential Revision: https://reviews.llvm.org/D66328
>>
>> Added:
>>     cfe/trunk/test/CodeGenCXX/debug-info-atexit-stub.cpp
>>     cfe/trunk/test/CodeGenCXX/debug-info-destroy-helper.cpp
>> Modified:
>>     cfe/trunk/include/clang/AST/GlobalDecl.h
>>     cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>     cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
>>     cfe/trunk/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp
>>     cfe/trunk/test/CodeGenCXX/debug-info-line.cpp
>>
>> Modified: cfe/trunk/include/clang/AST/GlobalDecl.h
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/GlobalDecl.h?rev=371080&r1=371079&r2=371080&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/AST/GlobalDecl.h (original)
>> +++ cfe/trunk/include/clang/AST/GlobalDecl.h Thu Sep  5 08:24:49 2019
>> @@ -31,6 +31,7 @@ enum class DynamicInitKind : unsigned {
>>    NoStub = 0,
>>    Initializer,
>>    AtExit,
>> +  GlobalArrayDestructor
>>  };
>>
>>  /// GlobalDecl - represents a global declaration. This can either be a
>>
>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=371080&r1=371079&r2=371080&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Sep  5 08:24:49 2019
>> @@ -1910,7 +1910,8 @@ StringRef CGDebugInfo::getDynamicInitial
>>                                                   llvm::Function *InitFn) {
>>    // If we're not emitting codeview, use the mangled name. For Itanium, 
>> this is
>>    // arbitrary.
>> -  if (!CGM.getCodeGenOpts().EmitCodeView)
>> +  if (!CGM.getCodeGenOpts().EmitCodeView ||
>> +      StubKind == DynamicInitKind::GlobalArrayDestructor)
>>      return InitFn->getName();
>>
>>    // Print the normal qualified name for the variable, then break off the 
>> last
>> @@ -1935,6 +1936,7 @@ StringRef CGDebugInfo::getDynamicInitial
>>
>>    switch (StubKind) {
>>    case DynamicInitKind::NoStub:
>> +  case DynamicInitKind::GlobalArrayDestructor:
>>      llvm_unreachable("not an initializer");
>>    case DynamicInitKind::Initializer:
>>      OS << "`dynamic initializer for '";
>> @@ -3569,7 +3571,8 @@ void CGDebugInfo::EmitFunctionStart(Glob
>>    if (Name.startswith("\01"))
>>      Name = Name.substr(1);
>>
>> -  if (!HasDecl || D->isImplicit() || D->hasAttr<ArtificialAttr>()) {
>> +  if (!HasDecl || D->isImplicit() || D->hasAttr<ArtificialAttr>() ||
>> +      (isa<VarDecl>(D) && GD.getDynamicInitKind() != 
>> DynamicInitKind::NoStub)) {
>>      Flags |= llvm::DINode::FlagArtificial;
>>      // Artificial functions should not silently reuse CurLoc.
>>      CurLoc = SourceLocation();
>>
>> Modified: cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=371080&r1=371079&r2=371080&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGDeclCXX.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGDeclCXX.cpp Thu Sep  5 08:24:49 2019
>> @@ -247,6 +247,8 @@ llvm::Function *CodeGenFunction::createA
>>
>>    CGF.StartFunction(GlobalDecl(&VD, DynamicInitKind::AtExit),
>>                      CGM.getContext().VoidTy, fn, FI, FunctionArgList());
>> +  // Emit an artificial location for this function.
>> +  auto AL = ApplyDebugLocation::CreateArtificial(CGF);
>>
>>    llvm::CallInst *call = CGF.Builder.CreateCall(dtor, addr);
>>
>> @@ -642,8 +644,9 @@ void CodeGenFunction::GenerateCXXGlobalV
>>
>>    StartFunction(GlobalDecl(D, DynamicInitKind::Initializer),
>>                  getContext().VoidTy, Fn, 
>> getTypes().arrangeNullaryFunction(),
>> -                FunctionArgList(), D->getLocation(),
>> -                D->getInit()->getExprLoc());
>> +                FunctionArgList());
>> +  // Emit an artificial location for this function.
>> +  auto AL = ApplyDebugLocation::CreateArtificial(*this);
>>
>>    // Use guarded initialization if the global variable is weak. This
>>    // occurs for, e.g., instantiated static data members and
>> @@ -768,7 +771,10 @@ llvm::Function *CodeGenFunction::generat
>>
>>    CurEHLocation = VD->getBeginLoc();
>>
>> -  StartFunction(VD, getContext().VoidTy, fn, FI, args);
>> +  StartFunction(GlobalDecl(VD, DynamicInitKind::GlobalArrayDestructor),
>> +                getContext().VoidTy, fn, FI, args);
>> +  // Emit an artificial location for this function.
>> +  auto AL = ApplyDebugLocation::CreateArtificial(*this);
>>
>>    emitDestroy(addr, type, destroyer, useEHCleanupForArray);
>>
>>
>> Added: cfe/trunk/test/CodeGenCXX/debug-info-atexit-stub.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-atexit-stub.cpp?rev=371080&view=auto
>> ==============================================================================
>> --- cfe/trunk/test/CodeGenCXX/debug-info-atexit-stub.cpp (added)
>> +++ cfe/trunk/test/CodeGenCXX/debug-info-atexit-stub.cpp Thu Sep  5 08:24:49 
>> 2019
>> @@ -0,0 +1,20 @@
>> +// RUN: %clang_cc1 -emit-llvm %s -triple x86_64-windows-msvc -gcodeview 
>> -debug-info-kind=limited -o - | FileCheck %s
>> +
>> +struct a {
>> +  ~a();
>> +};
>> +template <typename b> struct c : a {
>> +  c(void (b::*)());
>> +};
>> +struct B {
>> +  virtual void e();
>> +};
>> +c<B> *d() { static c<B> f(&B::e); return &f; }
>> +
>> +// CHECK: define internal void @"??__Ff@?1??d@@YAPEAU?$c@UB@@@@XZ@YAXXZ"()
>> +// CHECK-SAME: !dbg ![[SUBPROGRAM:[0-9]+]] {
>> +// CHECK: call void @"??1?$c@UB@@@@QEAA@XZ"(%struct.c* 
>> @"?f@?1??d@@YAPEAU?$c@UB@@@@XZ@4U2@A"), !dbg ![[LOCATION:[0-9]+]]
>> +// CHECK-NEXT: ret void, !dbg ![[LOCATION]]
>> +// CHECK: ![[SUBPROGRAM]] = distinct !DISubprogram(name: "`dynamic atexit 
>> destructor for 'f'"
>> +// CHECK-SAME: flags: DIFlagArtificial
>> +// CHECK: ![[LOCATION]] = !DILocation(line: 0, scope: ![[SUBPROGRAM]])
>> \ No newline at end of file
>>
>> Added: cfe/trunk/test/CodeGenCXX/debug-info-destroy-helper.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-destroy-helper.cpp?rev=371080&view=auto
>> ==============================================================================
>> --- cfe/trunk/test/CodeGenCXX/debug-info-destroy-helper.cpp (added)
>> +++ cfe/trunk/test/CodeGenCXX/debug-info-destroy-helper.cpp Thu Sep  5 
>> 08:24:49 2019
>> @@ -0,0 +1,24 @@
>> +// RUN: %clang_cc1 -emit-llvm %s -triple x86_64-windows-msvc -gcodeview 
>> -debug-info-kind=limited -o - | FileCheck %s
>> +
>> +struct b {
>> +  b(char *);
>> +  ~b();
>> +};
>> +struct a {
>> +  ~a();
>> +};
>> +struct {
>> +  b c;
>> +  const a &d;
>> +} e[]{nullptr, {}};
>> +
>> +// CHECK: define internal void @__cxx_global_array_dtor(i8* %0)
>> +// CHECK-SAME: !dbg ![[SUBPROGRAM:[0-9]+]] {
>> +// CHECK: arraydestroy.body
>> +// CHECK: %arraydestroy.elementPast =
>> +// CHECK-SAME: !dbg ![[LOCATION:[0-9]+]]
>> +// CHECK: call void @"??1<unnamed-type-e>@@QEAA@XZ"(%struct.anon* 
>> %arraydestroy.element)
>> +// CHECK-SAME: !dbg ![[LOCATION]]
>> +// CHECK: ![[SUBPROGRAM]] = distinct !DISubprogram(name: 
>> "__cxx_global_array_dtor"
>> +// CHECK-SAME: flags: DIFlagArtificial
>> +// CHECK: ![[LOCATION]] = !DILocation(line: 0,
>>
>> Modified: cfe/trunk/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp?rev=371080&r1=371079&r2=371080&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp (original)
>> +++ cfe/trunk/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp Thu Sep  5 
>> 08:24:49 2019
>> @@ -29,25 +29,26 @@ template <typename U>
>>  A FooTpl<T>::sdm_tpl(sizeof(U) + sizeof(T));
>>  template A FooTpl<int>::sdm_tpl<int>;
>>
>> -// CHECK-NOKEXT: !DISubprogram(name: "__cxx_global_var_init",{{.*}} line: 
>> 15,{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
>> -// CHECK-NOKEXT: !DISubprogram(name: "__dtor_glob",{{.*}} line: 15,{{.*}} 
>> DISPFlagLocalToUnit | DISPFlagDefinition
>> -// CHECK-NOKEXT: !DISubprogram(name: "__cxx_global_var_init.1",{{.*}} line: 
>> 16,{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
>> -// CHECK-NOKEXT: !DISubprogram(name: "__cxx_global_array_dtor",{{.*}} line: 
>> 16,{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
>> -// CHECK-NOKEXT: !DISubprogram(name: "__dtor_array",{{.*}} line: 16,{{.*}} 
>> DISPFlagLocalToUnit | DISPFlagDefinition
>> -// CHECK-NOKEXT: !DISubprogram(name: "__dtor__ZZ3foovE4stat",{{.*}} line: 
>> 19,{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
>> +// CHECK-NOKEXT: !DISubprogram(name: "__cxx_global_var_init",{{.*}} flags: 
>> DIFlagArtificial, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition
>> +// CHECK-NOKEXT: !DISubprogram(name: "__dtor_glob",{{.*}} flags: 
>> DIFlagArtificial, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition
>> +// CHECK-NOKEXT: !DISubprogram(name: "__cxx_global_var_init.1",{{.*}} 
>> flags: DIFlagArtificial, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition
>> +// CHECK-NOKEXT: !DISubprogram(name: "__cxx_global_array_dtor",{{.*}} 
>> flags: DIFlagArtificial, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition
>> +// CHECK-NOKEXT: !DISubprogram(name: "__dtor_array",{{.*}} flags: 
>> DIFlagArtificial, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition
>> +// CHECK-NOKEXT: !DISubprogram(name: "__dtor__ZZ3foovE4stat",{{.*}} flags: 
>> DIFlagArtificial, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition
>>  // CHECK-NOKEXT: !DISubprogram({{.*}} DISPFlagLocalToUnit | 
>> DISPFlagDefinition
>>
>>  // CHECK-KEXT: !DISubprogram({{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
>>
>> -// CHECK-MSVC: !DISubprogram(name: "`dynamic initializer for 'glob'",{{.*}} 
>> line: 15,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
>> -// CHECK-MSVC: !DISubprogram(name: "`dynamic atexit destructor for 
>> 'glob'",{{.*}} line: 15,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
>> -// CHECK-MSVC: !DISubprogram(name: "`dynamic initializer for 
>> 'array'",{{.*}} line: 16,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
>> -// CHECK-MSVC: !DISubprogram(name: "__cxx_global_array_dtor",{{.*}} line: 
>> 16,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
>> -// CHECK-MSVC: !DISubprogram(name: "`dynamic atexit destructor for 
>> 'array'",{{.*}} line: 16,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
>> -// CHECK-MSVC: !DISubprogram(name: "`dynamic atexit destructor for 
>> 'stat'",{{.*}} line: 19,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
>> +// CHECK-MSVC: !DISubprogram(name: "`dynamic initializer for 'glob'",{{.*}} 
>> flags: DIFlagArtificial, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition
>> +// CHECK-MSVC: !DISubprogram(name: "`dynamic atexit destructor for 
>> 'glob'",{{.*}} flags: DIFlagArtificial, spFlags: DISPFlagLocalToUnit | 
>> DISPFlagDefinition
>> +// CHECK-MSVC: !DISubprogram(name: "`dynamic initializer for 
>> 'array'",{{.*}} flags: DIFlagArtificial, spFlags: DISPFlagLocalToUnit | 
>> DISPFlagDefinition
>> +// CHECK-MSVC: !DISubprogram(name: "__cxx_global_array_dtor",{{.*}} flags: 
>> DIFlagArtificial, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition
>> +// CHECK-MSVC: !DISubprogram(name: "`dynamic atexit destructor for 
>> 'array'",{{.*}} flags: DIFlagArtificial, spFlags: DISPFlagLocalToUnit | 
>> DISPFlagDefinition
>> +// CHECK-MSVC: !DISubprogram(name: "`dynamic atexit destructor for 
>> 'stat'",{{.*}} flags: DIFlagArtificial, spFlags: DISPFlagLocalToUnit | 
>> DISPFlagDefinition
>>
>>  // MSVC does weird stuff when templates are involved, so we don't match 
>> exactly,
>>  // but these names are reasonable.
>>  // FIXME: These should not be marked DISPFlagLocalToUnit.
>> -// CHECK-MSVC: !DISubprogram(name: "FooTpl<int>::`dynamic initializer for 
>> 'sdm_tpl<int>'",{{.*}} line: 29,{{.*}}: DISPFlagLocalToUnit | 
>> DISPFlagDefinition
>> -// CHECK-MSVC: !DISubprogram(name: "FooTpl<int>::`dynamic atexit destructor 
>> for 'sdm_tpl<int>'",{{.*}} line: 29,{{.*}}: DISPFlagLocalToUnit | 
>> DISPFlagDefinition
>> +// CHECK-MSVC: !DISubprogram(name: "FooTpl<int>::`dynamic initializer for 
>> 'sdm_tpl<int>'",{{.*}} flags: DIFlagArtificial, spFlags: DISPFlagLocalToUnit 
>> | DISPFlagDefinition
>> +// CHECK-MSVC: !DISubprogram(name: "FooTpl<int>::`dynamic atexit destructor 
>> for 'sdm_tpl<int>'",{{.*}} flags: DIFlagArtificial, spFlags: 
>> DISPFlagLocalToUnit | DISPFlagDefinition
>> +// CHECK-MSVC: !DISubprogram(linkageName: 
>> "_GLOBAL__sub_I_debug_info_global_ctor_dtor.cpp",{{.*}} flags: 
>> DIFlagArtificial
>> \ No newline at end of file
>>
>> Modified: cfe/trunk/test/CodeGenCXX/debug-info-line.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-line.cpp?rev=371080&r1=371079&r2=371080&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/CodeGenCXX/debug-info-line.cpp (original)
>> +++ cfe/trunk/test/CodeGenCXX/debug-info-line.cpp Thu Sep  5 08:24:49 2019
>> @@ -314,7 +314,7 @@ void f25() {
>>  // CHECK: [[DBG_F9]] = !DILocation(line: 1000,
>>  // CHECK: [[DBG_F10_STORE]] = !DILocation(line: 1100,
>>  // CHECK: [[DBG_GLBL_CTOR_B]] = !DILocation(line: 1200,
>> -// CHECK: [[DBG_GLBL_DTOR_B]] = !DILocation(line: 1200,
>> +// CHECK: [[DBG_GLBL_DTOR_B]] = !DILocation(line: 0,
>>  // CHECK: [[DBG_F11]] = !DILocation(line: 1300,
>>  // CHECK: [[DBG_F12]] = !DILocation(line: 1400,
>>  // CHECK: [[DBG_F13]] = !DILocation(line: 1500,
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to