Thread overview
[Issue 10136] New: Segfault on File struct, map and array
May 22, 2013
Maxim Fomin
May 22, 2013
Stephan
Aug 20, 2013
Maxim Fomin
Aug 29, 2013
Maxim Fomin
May 22, 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@puremagic.com
        ReportedBy: maxim@maxim-fomin.ru


--- Comment #0 from Maxim Fomin <maxim@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: -------
May 22, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10136


Stephan <stephan.schiffels@mac.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stephan.schiffels@mac.com


--- Comment #1 from Stephan <stephan.schiffels@mac.com> 2013-05-22 16:38:56 PDT ---
*** Issue 10137 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 20, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10136


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #2 from bearophile_hugs@eml.cc 2013-08-20 12:56:52 PDT ---
In DMD 2.064alpha on Windows32 this seems to work to me.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 20, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10136


Maxim Fomin <maxim@maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|All                         |Linux


--- Comment #3 from Maxim Fomin <maxim@maxim-fomin.ru> 2013-08-20 13:01:49 PDT ---
(In reply to comment #2)
> In DMD 2.064alpha on Windows32 this seems to work to me.

It still segfaults in linux.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 28, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10136


monarchdodra@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra@gmail.com


--- Comment #4 from monarchdodra@gmail.com 2013-08-28 02:05:19 PDT ---
(In reply to comment #3)
> (In reply to comment #2)
> > In DMD 2.064alpha on Windows32 this seems to work to me.
> 
> It still segfaults in linux.

This is works for with 2.064 alpha on a linux 64.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 29, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10136


Maxim Fomin <maxim@maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME


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