Bug 15441 – dmd segfaults using std.experimental.ndslice

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-12-14T08:25:00Z
Last change time
2016-03-19T20:21:27Z
Keywords
ice, pull
Assigned to
nobody
Creator
sfrijters

Comments

Comment #0 by sfrijters — 2015-12-14T08:25:13Z
Using the 0.8.3 dub version of std.experimental.ndslice, dmd 2.069.1 segfaults on the following reduced code: import std.experimental.ndslice; void main() { Slice!(3, double*) force = new double[60].sliced(3, 4, 5); // Wrong foreach params. dmd failed with exit code -11. foreach(p, e; force) { } } See also [email protected].
Comment #1 by john.loughran.colvin — 2015-12-14T09:35:28Z
Further reduced: % cat test.d struct Slice { auto front()() {} } void foo() { Slice force; foreach(p, e; force){} } % dmd test.d [1] 18478 segmentation fault (core dumped) dmd test.d % lldb dmd (lldb) target create "dmd" Current executable set to 'dmd' (x86_64). (lldb) r test.d Process 18567 launched: '/usr/local/bin/dmd' (x86_64) Process 18567 stopped * thread #1: tid = 0xa054c, 0x000000010014c011 dmd`ForeachStatement::semantic(Scope*) + 11601, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0) frame #0: 0x000000010014c011 dmd`ForeachStatement::semantic(Scope*) + 11601 dmd`ForeachStatement::semantic: -> 0x10014c011 <+11601>: movq (%r13), %rax 0x10014c015 <+11605>: callq *0x1b8(%rax) 0x10014c01c <+11612>: testq %rax, %rax 0x10014c01f <+11615>: je 0x10014c031 ; <+11633> (lldb) bt all * thread #1: tid = 0xa054c, 0x000000010014c011 dmd`ForeachStatement::semantic(Scope*) + 11601, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0) * frame #0: 0x000000010014c011 dmd`ForeachStatement::semantic(Scope*) + 11601 frame #1: 0x0000000100146d4d dmd`CompoundStatement::semantic(Scope*) + 517 frame #2: 0x00000001000ba66a dmd`FuncDeclaration::semantic3(Scope*) + 4962 frame #3: 0x000000010006244a dmd`Module::semantic3() + 90 frame #4: 0x00000001000f6cc9 dmd`tryMain(unsigned long, char const**) + 28905 frame #5: 0x0000000100003b9b dmd`_Dmain + 47 frame #6: 0x0000000100219da8 dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 40 frame #7: 0x0000000100219ced dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 45 frame #8: 0x0000000100219d4d dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZv + 45 frame #9: 0x0000000100219ced dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 45 frame #10: 0x0000000100219c63 dmd`_d_run_main + 499 frame #11: 0x0000000100003c38 dmd`main + 20 frame #12: 0x00000001000021b8 dmd`_start + 230 frame #13: 0x00000001000020d1 dmd`start + 33
Comment #2 by jack — 2015-12-14T17:30:45Z
Same issue on OS X, so changing this to all OS's.
Comment #3 by k.hara.pg — 2015-12-15T04:11:13Z
Comment #4 by github-bugzilla — 2016-01-03T18:34:54Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/a52cb5f786fd9ff2a1db7d497fa6cf65ef3d5646 fix Issue 15441 - dmd segfaults using std.experimental.ndslice https://github.com/D-Programming-Language/dmd/commit/ef054013cd42d931c84a3706b0f365b125712bd4 Merge pull request #5309 from 9rnsr/fix15441 Issue 15441 - dmd segfaults using std.experimental.ndslice
Comment #5 by github-bugzilla — 2016-03-19T20:21:27Z