[Issue 15019] [ICE] Heisencrash on OS X 32-bit with non-trivial projects

2015-09-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15019

--- Comment #18 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/300f95cdad9dda22c98c62e4c09bef11926185d9
fix Issue 15019 - [ICE] Heisencrash on OS X 32-bit with non-trivial projects

https://github.com/D-Programming-Language/dmd/commit/3b02f50cd97f82a5f0b302e3535e9a835a636442
Merge pull request #5074 from WalterBright/fix15019

fix Issue 15019 - [ICE] Heisencrash on OS X 32-bit with non-trivial projects

--


[Issue 15019] [ICE] Heisencrash on OS X 32-bit with non-trivial projects

2015-09-14 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15019

--- Comment #17 from Vladimir Panteleev  ---
(In reply to Walter Bright from comment #15)
> I applied the patches and cannot reproduce it :-(

So have you reproduced it, or can I do something to help?

--


[Issue 15019] [ICE] Heisencrash on OS X 32-bit with non-trivial projects

2015-09-14 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15019

Walter Bright  changed:

   What|Removed |Added

   Severity|major   |critical

--- Comment #16 from Walter Bright  ---
https://github.com/D-Programming-Language/dmd/pull/5074

--


[Issue 15019] [ICE] Heisencrash on OS X 32-bit with non-trivial projects

2015-09-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15019

Vladimir Panteleev  changed:

   What|Removed |Added

   Assignee|nob...@puremagic.com|bugzi...@digitalmars.com

--- Comment #14 from Vladimir Panteleev  ---
(In reply to Vladimir Panteleev from comment #13)
> Anyway, the assert should make the crash deterministic and it should be
> possible to further reduce the test case.

Reduced:

/ test.d 
import std.string;

struct Color()
{
static fromHex(char[] s)
{
import std.conv;
s.to!ubyte;
}
}

Color!() RGB;

struct Matrix(T, int R, int C)
{
Vector!(T, C) row_t;
T[C] v;// all elements

/// Covnerts to pretty string.
string toString() const
{
try
return format("%s", v);
catch
assert(false); // should not happen since format is right
}
}

// GLSL is a big inspiration here
// we defines types with more or less the same names
template mat2x2(T) { Matrix!(T, 2, 2) mat2x2; }
template mat3x3(T) { Matrix!(T, 3, 3) mat3x3; }
template mat4x4(T) { Matrix!(T, 4, 4) mat4x4; }

alias mat2x2 mat2;
alias mat3x3 mat3;  // shorter names for most common matrices
alias mat4x4 mat4;

string definePostfixAliases(string type)
{
return "alias " ~ type ~ "!byte "   ~ type ~ "b;\n"
"alias " ~ type ~ "!ubyte "  ~ type ~ "ub;\n"
"alias " ~ type ~ "!short "  ~ type ~ "s;\n"
"alias " ~ type ~ "!ushort " ~ type ~ "us;\n"
"alias " ~ type ~ "!int "~ type ~ "i;\n"
"alias " ~ type ~ "!uint "   ~ type ~ "ui;\n"
"alias " ~ type ~ "!long "   ~ type ~ "l;\n"
"alias " ~ type ~ "!ulong "  ~ type ~ "ul;\n"
"alias " ~ type ~ "!float "  ~ type ~ "f;\n"
"alias " ~ type ~ "!double " ~ type ~ "d;\n";
}

// define a lot of type names
mixin(definePostfixAliases("mat2"));
mixin(definePostfixAliases("mat3"));
mixin(definePostfixAliases("mat4"));
import std.string;

struct Vector(T, int N)
{
T[N] v;

string toString()
{
try
return format("%s", v);
catch
assert(false);
}
}
/

Trips the assert with: dmd -m32 -c all.d

This is as far as I can go, though. Deferring to machobj.c's author, Walter
Bright.

--


[Issue 15019] [ICE] Heisencrash on OS X 32-bit with non-trivial projects

2015-09-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15019

--- Comment #15 from Walter Bright  ---
I applied the patches and cannot reproduce it :-(

--


[Issue 15019] [ICE] Heisencrash on OS X 32-bit with non-trivial projects

2015-09-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15019

--- Comment #13 from Vladimir Panteleev  ---
I think I found the cause of the memory corruption, but not the root cause of
the bug.

If you apply these patches:

https://github.com/CyberShadow/dmd/commit/2d424ac899535d975a6265b094c7f3fec217f4c5
https://github.com/CyberShadow/dmd/commit/0ea57be391b0a8307c1b5bf907506f74892ffe1d

you will see that the assert fails with the given test case, although the DMD
test suite passes with these asserts. It looks like DMD is trying to create a
relocation outside of the data segment? Here's the backtrace:

  * frame #0: 0x0001001d9a66 dmd`util_assert(file=0x000100322900,
line=278) + 22 at util2.c:55
frame #1: 0x0001001d072d dmd`local_assert(line=278) + 29 at
tassert.h:29
frame #2: 0x0001001d00d7
dmd`Outbuffer::setsize(this=0x000121e7d320, size=4100) + 55 at outbuf.c:278
frame #3: 0x00010022e767 dmd`Obj::bytes(seg=2, offset=4100, nbytes=4,
p=0x000100344f98) + 167 at machobj.c:2288
frame #4: 0x0001001b93c6 dmd`addtofixlist(s=0x000100cf9b40,
soffset=4100, seg=2, val=0, flags=16) + 374 at cgen.c:594
frame #5: 0x0001002325b6 dmd`Obj::reftoident(seg=2, offset=4100,
s=0x000100cf9b40, val=0, flags=16) + 150 at machobj.c:2469
frame #6: 0x00010019c9c5 dmd`el_ptr(s=0x000100cf9b40) + 261 at
el.c:1710
frame #7: 0x0001001606ca dmd`toElem(this=0x7fff5fbfd108,
fe=0x000121120be0)::ToElemVisitor::visit(FuncExp*) + 138 at e2ir.c:1154
frame #8: 0x00010008e986 dmd`FuncExp::accept(Visitor*) + 34 at
expression.d:6324
frame #9: 0x00010015a332 dmd`toElem(e=0x000121120be0,
irs=0x7fff5fbfd970) + 66 at e2ir.c:5485
frame #10: 0x00010016254c dmd`toElem(this=0x7fff5fbfd198,
pe=0x00012131e4d0)::ToElemVisitor::visit(PtrExp*) + 44 at e2ir.c:3690
frame #11: 0x00010009ad0e dmd`PtrExp::accept(Visitor*) + 34 at
expression.d:9738
frame #12: 0x00010015a332 dmd`toElem(e=0x00012131e4d0,
irs=0x7fff5fbfd970) + 66 at e2ir.c:5485
frame #13: 0x00010016204b dmd`toElem(this=0x7fff5fbfd328,
ce=0x000121120b90)::ToElemVisitor::visit(CallExp*) + 1179 at e2ir.c:3605
frame #14: 0x000100099f16 dmd`CallExp::accept(Visitor*) + 34 at
expression.d:9464
frame #15: 0x00010015a332 dmd`toElem(e=0x000121120b90,
irs=0x7fff5fbfd970) + 66 at e2ir.c:5485
frame #16: 0x000100166625 dmd`toElem(this=0x7fff5fbfd788,
ae=0x0001205dc9d0)::ToElemVisitor::visit(AssignExp*) + 8453 at e2ir.c:2949
frame #17: 0x0001000a3476 dmd`AssignExp::accept(Visitor*) + 34 at
expression.d:12155
frame #18: 0x00010015a332 dmd`toElem(e=0x0001205dc9d0,
irs=0x7fff5fbfd970) + 66 at e2ir.c:5485
frame #19: 0x00010015b8a8 dmd`toElemDtor(e=0x0001205dc9d0,
irs=0x7fff5fbfd970) + 88 at e2ir.c:5578
frame #20: 0x00010014f3a2
dmd`S2irVisitor::visit(this=0x7fff5fbfd890, s=0x000121120b00) + 130 at
s2ir.c:846
frame #21: 0x00010011aa73 dmd`ExpStatement::accept(Visitor*) + 31 at
statement.d:1247
frame #22: 0x00010014f242 dmd`Statement_toIR(s=0x000121120b00,
irs=0x7fff5fbfd970) + 66 at s2ir.c:1283
frame #23: 0x00010014f446
dmd`S2irVisitor::visit(this=0x7fff5fbfd930, s=0x000121121f10) + 134 at
s2ir.c:862
frame #24: 0x00010011bd83 dmd`CompoundStatement::accept(Visitor*) + 31
at statement.d:1587
frame #25: 0x00010014f242 dmd`Statement_toIR(s=0x000121121f10,
irs=0x7fff5fbfd970) + 66 at s2ir.c:1283
frame #26: 0x00010014f6b5
dmd`S2irVisitor::visit(this=0x7fff5fbfda60, s=0x000121121e40) + 149 at
s2ir.c:922
frame #27: 0x00010011c4d3 dmd`ScopeStatement::accept(Visitor*) + 31 at
statement.d:1763
frame #28: 0x00010014f242 dmd`Statement_toIR(s=0x000121121e40,
irs=0x7fff5fbfdad0) + 66 at s2ir.c:1283
frame #29: 0x00010014f588
dmd`S2irVisitor::visit(this=0x7fff5fbfdbc0, s=0x000121121e60) + 280 at
s2ir.c:895
frame #30: 0x00010011c173 dmd`UnrolledLoopStatement::accept(Visitor*) +
31 at statement.d:1677
frame #31: 0x00010014f242 dmd`Statement_toIR(s=0x000121121e60,
irs=0x7fff5fbfdc00) + 66 at s2ir.c:1283
frame #32: 0x00010014f6b5
dmd`S2irVisitor::visit(this=0x7fff5fbfdcf0, s=0x000121118060) + 149 at
s2ir.c:922
frame #33: 0x00010011c4d3 dmd`ScopeStatement::accept(Visitor*) + 31 at
statement.d:1763
frame #34: 0x00010014f242 dmd`Statement_toIR(s=0x000121118060,
irs=0x7fff5fbfdd58) + 66 at s2ir.c:1283
frame #35: 0x00010014fd9b
dmd`S2irVisitor::visit(this=0x7fff5fbfde50, s=0x000121118020) + 331 at
s2ir.c:198
frame #36: 0x000100123e23 dmd`IfStatement::accept(Visitor*) + 31 at
statement.d:3287
frame #37: 0x00010014f242 dmd`Statement_toIR(s=0x000121118020,
irs=0x7fff5fbfe328) + 66 at s2ir.c:1283
frame #38: 0x00010014f446

[Issue 15019] [ICE] Heisencrash on OS X 32-bit with non-trivial projects

2015-09-11 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15019

ponce  changed:

   What|Removed |Added

Summary|[ICE] Heisencrash on OS X   |[ICE] Heisencrash on OS X
   |with non-trivial projects   |32-bit with non-trivial
   ||projects

--


[Issue 15019] [ICE] Heisencrash on OS X 32-bit with non-trivial projects

2015-09-11 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15019

--- Comment #12 from Vladimir Panteleev  ---
WIP here, will continue tomorrow:

https://github.com/CyberShadow/dmd/commits/valgrind-20150912

--