D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 14310 - [REG2.067a] InvalidMemoryOperationError in std.stdio.File.byLine
Summary: [REG2.067a] InvalidMemoryOperationError in std.stdio.File.byLine
Status: RESOLVED DUPLICATE of issue 13856
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-19 21:46 UTC by Martin Krejcirik
Modified: 2015-03-19 22:36 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Martin Krejcirik 2015-03-19 21:46:26 UTC
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 Martin Krejcirik 2015-03-19 21:53:04 UTC
Input file here: http://bid.iline.cz/~mk/tmp/wcbugxml.bz2
Comment 2 Vladimir Panteleev 2015-03-19 22:05:10 UTC
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 Martin Krejcirik 2015-03-19 22:16:12 UTC
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 Martin Krejcirik 2015-03-19 22:36:10 UTC

*** This issue has been marked as a duplicate of issue 13856 ***