www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Segmentation fault building druntime head on OS X

reply "Paolo Invernizzi" <paolo.invernizzi no.address> writes:
Hi,

Just to know if someone else has the same issue:

   OS X 10.10.1 Xcode 6.1 (6a1052d)
   cc --version Apple LLVM version 6.0 (clang-600.0.54) (based on 
LLVM 3.5svn)

DMD is builded just fine:

   DMD64 D Compiler v2.067-devel-e17631e

But the dmd crash on building druntime:

semantic3 treap
     semantic3 ti_AC
     semantic3 ti_Acdouble
     semantic3 ti_Acfloat
     Process 5286 stopped
     * thread #1: tid = 0x5277, 0x000000010002df7d 
dmd`ComplexExp::ComplexExp(Loc, complex_t, Type*) + 45, queue = 
'com.apple.main-thread', stop reason = EXC_BAD_ACCESS 
(code=EXC_I386_GPFLT)
         frame #0: 0x000000010002df7d 
dmd`ComplexExp::ComplexExp(Loc, complex_t, Type*) + 45
     dmd`ComplexExp::ComplexExp(Loc, complex_t, Type*) + 45:
     -> 0x10002df7d:  movaps %xmm1, 0x40(%rdi)
        0x10002df81:  movaps %xmm0, 0x30(%rdi)
        0x10002df85:  movq   %rcx, 0x20(%rdi)
        0x10002df89:  popq   %rbp
     (lldb) bt
     * thread #1: tid = 0x5277, 0x000000010002df7d 
dmd`ComplexExp::ComplexExp(Loc, complex_t, Type*) + 45, queue = 
'com.apple.main-thread', stop reason = EXC_BAD_ACCESS 
(code=EXC_I386_GPFLT)
       * frame #0: 0x000000010002df7d 
dmd`ComplexExp::ComplexExp(Loc, complex_t, Type*) + 45
         frame #1: 0x000000010001597f dmd`Cast(Type*, Type*, 
Expression*) + 879
         frame #2: 0x00000001000a0074 
dmd`Expression_optimize(Expression*, int, 
bool)::OptimizeVisitor::visit(CastExp*) + 964
         frame #3: 0x000000010009f265 
dmd`Expression_optimize(Expression*, int, 
bool)::OptimizeVisitor::visit(BinExp*) + 133
         frame #4: 0x000000010009ebfa 
dmd`Expression_optimize(Expression*, int, bool) + 42
         frame #5: 0x00000001000b822e 
dmd`ExpStatement::semantic(Scope*) + 94
         frame #6: 0x00000001000b8ccc 
dmd`CompoundStatement::semantic(Scope*) + 284
         frame #7: 0x00000001000c02df 
dmd`IfStatement::semantic(Scope*) + 783
         frame #8: 0x00000001000b8ccc 
dmd`CompoundStatement::semantic(Scope*) + 284
         frame #9: 0x00000001000543b1 
dmd`FuncDeclaration::semantic3(Scope*) + 3425
         frame #10: 0x0000000100057c46 
dmd`FuncDeclaration::functionSemantic3() + 102
         frame #11: 0x000000010002a825 dmd`functionParameters(Loc, 
Scope*, TypeFunction*, Type*, Array<Expression*>*, 
FuncDeclaration*, Type**, Expression**) + 277
         frame #12: 0x000000010003f03e 
dmd`CallExp::semantic(Scope*) + 11822
         frame #13: 0x000000010003835a 
dmd`BinExp::binSemanticProp(Scope*) + 42
         frame #14: 0x000000010009cd6d 
dmd`op_overload(Expression*, 
Scope*)::OpOverload::visit(BinAssignExp*) + 1645
         frame #15: 0x000000010009965c 
dmd`op_overload(Expression*, Scope*) + 44
         frame #16: 0x0000000100038bdd 
dmd`BinAssignExp::semantic(Scope*) + 45
         frame #17: 0x00000001000b81f3 
dmd`ExpStatement::semantic(Scope*) + 35
         frame #18: 0x00000001000b8ccc 
dmd`CompoundStatement::semantic(Scope*) + 284
         frame #19: 0x00000001000ba2d1 
dmd`ForStatement::semantic(Scope*) + 657
         frame #20: 0x00000001000b8ccc 
dmd`CompoundStatement::semantic(Scope*) + 284
         frame #21: 0x00000001000b9a8e 
dmd`ScopeStatement::semantic(Scope*) + 158
         frame #22: 0x00000001000ba130 
dmd`ForStatement::semantic(Scope*) + 240
         frame #23: 0x00000001000bdf05 
dmd`ForeachStatement::semantic(Scope*) + 14741
         frame #24: 0x00000001000b8ccc 
dmd`CompoundStatement::semantic(Scope*) + 284
         frame #25: 0x00000001000543b1 
dmd`FuncDeclaration::semantic3(Scope*) + 3425
         frame #26: 0x00000001000018b5 
dmd`AttribDeclaration::semantic3(Scope*) + 85
         frame #27: 0x00000001000d7d54 
dmd`TemplateInstance::semantic3(Scope*) + 276
         frame #28: 0x00000001000d2709 
dmd`TemplateInstance::semantic(Scope*, Array<Expression*>*) + 2425
         frame #29: 0x000000010003250a 
dmd`ScopeExp::semantic(Scope*) + 154
         frame #30: 0x000000010002713e 
dmd`DotIdExp::semanticX(Scope*) + 30
         frame #31: 0x0000000100026da1 dmd`resolveUFCS(Scope*, 
CallExp*) + 129
         frame #32: 0x000000010003c3d7 
dmd`CallExp::semantic(Scope*) + 455
         frame #33: 0x00000001000c26f5 
dmd`ReturnStatement::semantic(Scope*) + 677
         frame #34: 0x00000001000b8ccc 
dmd`CompoundStatement::semantic(Scope*) + 284
         frame #35: 0x00000001000543b1 
dmd`FuncDeclaration::semantic3(Scope*) + 3425
         frame #36: 0x00000001000c94b4 
dmd`AggregateDeclaration::semantic3(Scope*) + 228
         frame #37: 0x000000010007c754 dmd`Module::semantic3() + 84
         frame #38: 0x0000000100079d30 dmd`tryMain(unsigned long, 
char const**) + 10560
         frame #39: 0x0000000100000a28 dmd`_start + 230
         frame #40: 0x0000000100000941 dmd`start + 33
     (lldb)

That's a clean build from Digger...
Thanks in advance.

---
Paolo
Dec 01 2014
next sibling parent "John Colvin" <john.loughran.colvin gmail.com> writes:
On Monday, 1 December 2014 at 09:48:20 UTC, Paolo Invernizzi 
wrote:
 Hi,

 Just to know if someone else has the same issue:

   OS X 10.10.1 Xcode 6.1 (6a1052d)
   cc --version Apple LLVM version 6.0 (clang-600.0.54) (based 
 on LLVM 3.5svn)

 DMD is builded just fine:

   DMD64 D Compiler v2.067-devel-e17631e

 But the dmd crash on building druntime:

 semantic3 treap
     semantic3 ti_AC
     semantic3 ti_Acdouble
     semantic3 ti_Acfloat
     Process 5286 stopped
     * thread #1: tid = 0x5277, 0x000000010002df7d 
 dmd`ComplexExp::ComplexExp(Loc, complex_t, Type*) + 45, queue = 
 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS 
 (code=EXC_I386_GPFLT)
         frame #0: 0x000000010002df7d 
 dmd`ComplexExp::ComplexExp(Loc, complex_t, Type*) + 45
     dmd`ComplexExp::ComplexExp(Loc, complex_t, Type*) + 45:
     -> 0x10002df7d:  movaps %xmm1, 0x40(%rdi)
        0x10002df81:  movaps %xmm0, 0x30(%rdi)
        0x10002df85:  movq   %rcx, 0x20(%rdi)
        0x10002df89:  popq   %rbp
     (lldb) bt
     * thread #1: tid = 0x5277, 0x000000010002df7d 
 dmd`ComplexExp::ComplexExp(Loc, complex_t, Type*) + 45, queue = 
 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS 
 (code=EXC_I386_GPFLT)
       * frame #0: 0x000000010002df7d 
 dmd`ComplexExp::ComplexExp(Loc, complex_t, Type*) + 45
         frame #1: 0x000000010001597f dmd`Cast(Type*, Type*, 
 Expression*) + 879
         frame #2: 0x00000001000a0074 
 dmd`Expression_optimize(Expression*, int, 
 bool)::OptimizeVisitor::visit(CastExp*) + 964
         frame #3: 0x000000010009f265 
 dmd`Expression_optimize(Expression*, int, 
 bool)::OptimizeVisitor::visit(BinExp*) + 133
         frame #4: 0x000000010009ebfa 
 dmd`Expression_optimize(Expression*, int, bool) + 42
         frame #5: 0x00000001000b822e 
 dmd`ExpStatement::semantic(Scope*) + 94
         frame #6: 0x00000001000b8ccc 
 dmd`CompoundStatement::semantic(Scope*) + 284
         frame #7: 0x00000001000c02df 
 dmd`IfStatement::semantic(Scope*) + 783
         frame #8: 0x00000001000b8ccc 
 dmd`CompoundStatement::semantic(Scope*) + 284
         frame #9: 0x00000001000543b1 
 dmd`FuncDeclaration::semantic3(Scope*) + 3425
         frame #10: 0x0000000100057c46 
 dmd`FuncDeclaration::functionSemantic3() + 102
         frame #11: 0x000000010002a825 
 dmd`functionParameters(Loc, Scope*, TypeFunction*, Type*, 
 Array<Expression*>*, FuncDeclaration*, Type**, Expression**) + 
 277
         frame #12: 0x000000010003f03e 
 dmd`CallExp::semantic(Scope*) + 11822
         frame #13: 0x000000010003835a 
 dmd`BinExp::binSemanticProp(Scope*) + 42
         frame #14: 0x000000010009cd6d 
 dmd`op_overload(Expression*, 
 Scope*)::OpOverload::visit(BinAssignExp*) + 1645
         frame #15: 0x000000010009965c 
 dmd`op_overload(Expression*, Scope*) + 44
         frame #16: 0x0000000100038bdd 
 dmd`BinAssignExp::semantic(Scope*) + 45
         frame #17: 0x00000001000b81f3 
 dmd`ExpStatement::semantic(Scope*) + 35
         frame #18: 0x00000001000b8ccc 
 dmd`CompoundStatement::semantic(Scope*) + 284
         frame #19: 0x00000001000ba2d1 
 dmd`ForStatement::semantic(Scope*) + 657
         frame #20: 0x00000001000b8ccc 
 dmd`CompoundStatement::semantic(Scope*) + 284
         frame #21: 0x00000001000b9a8e 
 dmd`ScopeStatement::semantic(Scope*) + 158
         frame #22: 0x00000001000ba130 
 dmd`ForStatement::semantic(Scope*) + 240
         frame #23: 0x00000001000bdf05 
 dmd`ForeachStatement::semantic(Scope*) + 14741
         frame #24: 0x00000001000b8ccc 
 dmd`CompoundStatement::semantic(Scope*) + 284
         frame #25: 0x00000001000543b1 
 dmd`FuncDeclaration::semantic3(Scope*) + 3425
         frame #26: 0x00000001000018b5 
 dmd`AttribDeclaration::semantic3(Scope*) + 85
         frame #27: 0x00000001000d7d54 
 dmd`TemplateInstance::semantic3(Scope*) + 276
         frame #28: 0x00000001000d2709 
 dmd`TemplateInstance::semantic(Scope*, Array<Expression*>*) + 
 2425
         frame #29: 0x000000010003250a 
 dmd`ScopeExp::semantic(Scope*) + 154
         frame #30: 0x000000010002713e 
 dmd`DotIdExp::semanticX(Scope*) + 30
         frame #31: 0x0000000100026da1 dmd`resolveUFCS(Scope*, 
 CallExp*) + 129
         frame #32: 0x000000010003c3d7 
 dmd`CallExp::semantic(Scope*) + 455
         frame #33: 0x00000001000c26f5 
 dmd`ReturnStatement::semantic(Scope*) + 677
         frame #34: 0x00000001000b8ccc 
 dmd`CompoundStatement::semantic(Scope*) + 284
         frame #35: 0x00000001000543b1 
 dmd`FuncDeclaration::semantic3(Scope*) + 3425
         frame #36: 0x00000001000c94b4 
 dmd`AggregateDeclaration::semantic3(Scope*) + 228
         frame #37: 0x000000010007c754 dmd`Module::semantic3() + 
 84
         frame #38: 0x0000000100079d30 dmd`tryMain(unsigned 
 long, char const**) + 10560
         frame #39: 0x0000000100000a28 dmd`_start + 230
         frame #40: 0x0000000100000941 dmd`start + 33
     (lldb)

 That's a clean build from Digger...
 Thanks in advance.

 ---
 Paolo
I get the same. Two separate dustmite reductions got me https://issues.dlang.org/show_bug.cgi?id=13795 and https://issues.dlang.org/show_bug.cgi?id=13788 I suspect it's showing up because of building with clang. IIRC it only happens if you build a release version of the compiler.
Dec 01 2014
prev sibling parent reply "Sean Kelly" <sean invisibleduck.org> writes:
A few years back, clang was generating an invalid copy ctor for a 
struct in DMD. I assume this has long since been fixed, but 
clearly clang still has a few bugs.
Dec 01 2014
parent reply Jacob Carlborg <doob me.com> writes:
On 2014-12-01 18:03, Sean Kelly wrote:
 A few years back, clang was generating an invalid copy ctor for a struct
 in DMD. I assume this has long since been fixed, but clearly clang still
 has a few bugs.
Lately I've only been able to successfully run the whole test suite for DMD if it was compiled with Clang. -- /Jacob Carlborg
Dec 01 2014
parent "Sean Kelly" <sean invisibleduck.org> writes:
On Monday, 1 December 2014 at 20:42:06 UTC, Jacob Carlborg wrote:
 On 2014-12-01 18:03, Sean Kelly wrote:
 A few years back, clang was generating an invalid copy ctor 
 for a struct
 in DMD. I assume this has long since been fixed, but clearly 
 clang still
 has a few bugs.
Lately I've only been able to successfully run the whole test suite for DMD if it was compiled with Clang.
So I get the DMD crash building *anything* with the release version of DMD from git HEAD. I generated a debug build though and it works fine. So it sounds like a codegen bug to me, but I haven't taken the time to try and figure it out. The crash I saw was in a ctor though. If it's anything like the crash I saw back when OS X was moving to clang, it will be that the "this" pointer has a bad offset.
Dec 01 2014