www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10690] New: Assertion failure in swap caused by array() of a filter() of tuples of string

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

           Summary: Assertion failure in swap caused by array() of a
                    filter() of tuples of string
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2013-07-21 09:15:11 PDT ---
import std.algorithm: filter;
import std.array: array;
import std.typecons: tuple;
void main() {
    [tuple(1)].filter!(t => true).array; // No error
    [tuple("A")].filter!(t => true).array; // error
}


DMD 2.064alpha gives me:

core.exception.AssertError std.algorithm(1923): Assertion failure

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


monarchdodra gmail.com changed:

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


--- Comment #1 from monarchdodra gmail.com 2013-07-21 23:54:05 PDT ---
(In reply to comment #0)
 import std.algorithm: filter;
 import std.array: array;
 import std.typecons: tuple;
 void main() {
     [tuple(1)].filter!(t => true).array; // No error
     [tuple("A")].filter!(t => true).array; // error
 }
 
 
 DMD 2.064alpha gives me:
 
 core.exception.AssertError std.algorithm(1923): Assertion failure
This looks like a combination of: http://d.puremagic.com/issues/show_bug.cgi?id=9824 Basically, emplace is calling opAssign over a garbage struct. This leads to undefined bahavior, since the implementation of Tupple's opAssign assume the current Tuple to be in a known state (to use the "swap-and-destroy" strategy) And bug http://d.puremagic.com/issues/show_bug.cgi?id=9975 Where, arguably, swap has no business making that assertion. This should spontaneously resolve itself once either of these two bugs are fixed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 21 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10690



--- Comment #2 from bearophile_hugs eml.cc 2013-07-22 04:56:43 PDT ---
(In reply to comment #1)

 This should spontaneously resolve itself once either of these two bugs are
 fixed.
OK. In the meantime this regression is breaking a good amount of my code. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 22 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10690



--- Comment #3 from monarchdodra gmail.com 2013-07-22 23:03:18 PDT ---
(In reply to comment #2)
 (In reply to comment #1)
 
 This should spontaneously resolve itself once either of these two bugs are
 fixed.
OK. In the meantime this regression is breaking a good amount of my code.
I was curious about what happened, since these are old outstanding bugs. The regression itself was introduced by the correct "swap and destroy" introduced in tuple here: https://github.com/D-Programming-Language/phobos/commit/d8c6187d6e94ed794382e4b21b7876085cb523b2#std/typecons.d -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 22 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10690


David Nadlinger <code klickverbot.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code klickverbot.at


--- Comment #4 from David Nadlinger <code klickverbot.at> 2013-08-28 01:45:39
PDT ---
The emplace changes from issue 9824 are in, but the problem still occurs in Git
master.

-- 
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=10690



--- Comment #5 from monarchdodra gmail.com 2013-08-28 02:02:45 PDT ---
(In reply to comment #4)
 The emplace changes from issue 9824 are in, but the problem still occurs in Git
 master.
Problem is actually in Appender now: Kenji's safe/pure appender isn't using emplace. -- 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=10690



--- Comment #6 from monarchdodra gmail.com 2013-08-28 04:29:47 PDT ---
(In reply to comment #5)
 (In reply to comment #4)
 The emplace changes from issue 9824 are in, but the problem still occurs in Git
 master.
Problem is actually in Appender now: Kenji's safe/pure appender isn't using emplace.
https://github.com/D-Programming-Language/phobos/pull/1529 Apologies to Kenji, the bug was pre-existing. -- 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=10690



--- Comment #7 from Denis Shelomovskij <verylonglogin.reg gmail.com> 2013-09-30
18:19:59 MSD ---
*** Issue 10859 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: -------
Sep 30 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10690


Andrei Alexandrescu <andrei erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrei erdani.com
         Resolution|                            |FIXED


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