Bug 14310 – [REG2.067a] InvalidMemoryOperationError in std.stdio.File.byLine

Status
RESOLVED
Resolution
DUPLICATE
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-03-19T21:46:00Z
Last change time
2015-03-19T22:36:10Z
Assigned to
nobody
Creator
mk

Comments

Comment #0 by mk — 2015-03-19T21:46:26Z
I get core.exception.InvalidMemoryOperationError@(0) when I run the following program on attached input file (XML). import std.algorithm, std.file, std.stdio, std.string; int main(string[] args) { if (args.length < 2) { return 1; } size_t linect = 0; foreach (line; File(args[1]).byLine()) linect += 1; return 0; } Backtrace: Breakpoint 1, 0x080b07fc in _d_throwc () (gdb) bt #0 0x080b07fc in _d_throwc () #1 0x080b1208 in _d_arrayshrinkfit () #2 0x080ac4d4 in object.assumeSafeAppend!(char).assumeSafeAppend(ref inout(char[])) (arr=0x81210d4) at /home/mk/dmd2.test/src/druntime/import/object.di:662 #3 0x080abbc8 in std.stdio.File.ByLineImpl!(char, char).ByLineImpl.popFront() (this=0x81210c8) at /home/mk/dmd2.test/src/phobos/std/stdio.d:1677 #4 0x080ab9eb in std.stdio.File.ByLine!(char, char).ByLine.popFront() (this=0xffffd914) at /home/mk/dmd2.test/src/phobos/std/stdio.d:1624 #5 0x080ab88b in D main (args=...) at wcbug.d:10 (gdb) c Continuing. core.exception.InvalidMemoryOperationError@(0) This happens with 2.067b and master. 2.066 no error. System linux.
Comment #1 by mk — 2015-03-19T21:53:04Z
Comment #2 by dlang-bugzilla — 2015-03-19T22:05:10Z
I can't reproduce this on Windows. Looks like a duplicate of issue 13856 and particularly issue 14005 except for that this one is a regression?
Comment #3 by mk — 2015-03-19T22:16:12Z
It depend(In reply to Vladimir Panteleev from comment #2) > I can't reproduce this on Windows. Looks like a duplicate of issue 13856 > and particularly issue 14005 except for that this one is a regression? I have tried several older dmd versions and none crash, but it may be a coincidence. Also depends on input.
Comment #4 by mk — 2015-03-19T22:36:10Z
*** This issue has been marked as a duplicate of issue 13856 ***