www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10859] New: Problem with array() of a map Range of simple tuples

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10859

           Summary: Problem with array() of a map Range of simple tuples
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



I don't know if this is a regression. Here "words.txt" is just a file of words
separated by a newline:


import std.stdio: File;
import std.algorithm: map;
import std.typecons: tuple;
import std.array: array;
void main() {
    File("words.txt")
    .byLine
    .map!(line => tuple(line))
    .array
    ;
}


If I compile with -g it gives at run-time, dmd 2.064alpha:


core.exception.AssertError std.algorithm(1927): Assertion failure
----------------
0x00424903 in onAssertError
0x0040ED86 in pure nothrow  safe void
std.typecons.Tuple!(char[]).Tuple.opAssign!(std.typecons.Tuple!(char[]).Tuple).opAssign(std.typecons.Tuple!(char[]).Tuple)
at ...\dmd2\src\phobos\std\typecons.d(525)
0x0040F5A4 in pure nothrow  safe void
std.array.Appender!(std.typecons.Tuple!(char[]).Tuple[]).Appender.put!(std.typecons.Tuple!(char[]).Tuple).put(std.typecons.Tuple!(char[]).Tuple)
at ...\dmd2\src\phobos\std\array.d(2347)
0x0040EE72 in
D3std5array116__T5arrayTS6test5b4main80__T9MapResultS226test5b4main9__lambda2TS3std5stdio4File1F8E0F5CC6B0162C488BCADE9A33A8B01
at ...\dmd2\src\phobos\std\array.d(70)
0x00402087 in _Dmain at ...\test5b.d(7)
0x0041C580 in extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).void runMain()
0x0041C610 in extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).void runAll()
0x0041BEED in _d_run_main
0x004084D0 in main
0x00432825 in mainCRTStartup
0x7691D2E9 in BaseThreadInitThunk
0x76FB1603 in RtlInitializeExceptionChain
0x76FB15D6 in RtlInitializeExceptionChain
----------------


If inside the main I replace "array" with "writeln" the program works
correctly.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 20 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10859


monarchdodra gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra gmail.com
           See Also|                            |http://d.puremagic.com/issu
                   |                            |es/show_bug.cgi?id=9975





Array calls appender.

appender calls opAssign on un-initilized memory (which is wrong: It should call
emplace... but emplace is broken, so that wouldn't change much anyways)

In any case, once inside Tuple.opAssign, the implementation will *swap*
(correctly).

Unfortunatly, since "this" is not initialized, an assert will trigger in
"swap", as the string "points" to the other object.

There are many steps involved for a "full" recovery, but I think that removing
the "pointsTo" assertion in "swap" is the first step:
http://d.puremagic.com/issues/show_bug.cgi?id=9975#c14
https://github.com/D-Programming-Language/phobos/pull/1390

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 20 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10859


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim maxim-fomin.ru



---
It seems that http://d.puremagic.com/issues/show_bug.cgi?id=10136 is probably
related to this issue.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 20 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10859





 It seems that http://d.puremagic.com/issues/show_bug.cgi?id=10136 is probably
 related to this issue.
It seems Issue 10136 is a worksforme. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 20 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10859






 
 Array calls appender.
 
 appender calls opAssign on un-initilized memory (which is wrong: It should call
 emplace... but emplace is broken, so that wouldn't change much anyways)
 
 In any case, once inside Tuple.opAssign, the implementation will *swap*
 (correctly).
 
 Unfortunatly, since "this" is not initialized, an assert will trigger in
 "swap", as the string "points" to the other object.
 
 There are many steps involved for a "full" recovery, but I think that removing
 the "pointsTo" assertion in "swap" is the first step:
 http://d.puremagic.com/issues/show_bug.cgi?id=9975#c14
 https://github.com/D-Programming-Language/phobos/pull/1390
Still same symptoms as 10690: Not fixed because appender calls opAssign. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 28 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10859







 
 Array calls appender.
 
 appender calls opAssign on un-initilized memory (which is wrong: It should call
 emplace... but emplace is broken, so that wouldn't change much anyways)
 
 In any case, once inside Tuple.opAssign, the implementation will *swap*
 (correctly).
 
 Unfortunatly, since "this" is not initialized, an assert will trigger in
 "swap", as the string "points" to the other object.
 
 There are many steps involved for a "full" recovery, but I think that removing
 the "pointsTo" assertion in "swap" is the first step:
 http://d.puremagic.com/issues/show_bug.cgi?id=9975#c14
 https://github.com/D-Programming-Language/phobos/pull/1390
Still same symptoms as 10690: Not fixed because appender calls opAssign.
https://github.com/D-Programming-Language/phobos/pull/1529 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 28 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10859


Denis Shelomovskij <verylonglogin.reg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |verylonglogin.reg gmail.com
         Resolution|                            |DUPLICATE



18:19:59 MSD ---
This is a clear dup caused by same appender issue (onAssign call on garbage).

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

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