[Issue 10136] New: Segfault on File struct, map and array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 22 12:49:58 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10136

           Summary: Segfault on File struct, map and array
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: maxim at maxim-fomin.ru


--- Comment #0 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-05-22 12:49:55 PDT ---
>From forum thread:

import std.array;
import std.algorithm;
import std.stdio;

void main() {
  auto names = ["file1.txt", "file2.txt", "file3.txt"];  // let these files
exist
  auto files = names.map!(f => File(f, "r"))().array();
}

This segfaults.
Some notes:
1) Without .array it works.
2) In valgrind there is assertion failure in swap phobos function which bails
out when lhs pointer == rhs pointer. These equal pointers are passed by struct
File.opAssign, which, in turn, is called by emplace, which, in turn, is called
by array phobos function. Probably there is typo error or wrong-code in this
chain.
3) In gdb there is segfault inside GC internals after main() exit which likely
to be irrelevant since memory is corrupted before exit.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list