www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14310] New: [REG2.067a] InvalidMemoryOperationError in


          Issue ID: 14310
           Summary: [REG2.067a] InvalidMemoryOperationError in
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: mk krej.cz

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;


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()
    at /home/mk/dmd2.test/src/phobos/std/stdio.d:1677
#4  0x080ab9eb in std.stdio.File.ByLine!(char, char).ByLine.popFront()
    at /home/mk/dmd2.test/src/phobos/std/stdio.d:1624
#5  0x080ab88b in D main (args=...) at wcbug.d:10
(gdb) c
core.exception.InvalidMemoryOperationError (0)

This happens with 2.067b and master. 2.066 no error. System linux.

Mar 19 2015