www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5998] New: Problem with heapified Array!BigInt

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

           Summary: Problem with heapified Array!BigInt
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



I am not sure what's happening here (so no keywords), probably I am missing
something. I am not even sure this is a bug, so it's better to ask here first.
This crashes at runtime with no stack trace (DMD 2.053):


import std.stdio, std.bigint, std.container;
int foo() {
    Array!BigInt bar;
    bar ~= BigInt(2);
    auto spam = heapify(bar);
    spam.insert(BigInt(10));
    spam.insert(BigInt(20));
    return 1;
}
void main() {
    writeln(foo());
}


If I replace the BigInts with ints:

import std.stdio, std.container;
int foo() {
    Array!int bar;
    bar ~= 2;
    auto spam = heapify(bar);
    spam.insert(10);
    spam.insert(20);
    return 1;
}
void main() {
    writeln(foo());
}


I get:
...\dmd\src\phobos\std\container.d(2660): Error: this._store()[this._length()]
is not an lvalue

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 14 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5998


kennytm gmail.com changed:

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



I've got a stack trace for the first code in OS X.


core.exception.AssertError std.typecons(2366): Assertion failure
----------------
5   x                                   0x00016a8d onAssertError + 65
6   x                                   0x00020ace _d_assertm + 30
7   x                                   0x00044e8c void
std.typecons.__assert(int) + 24
8   x                                   0x000041ea void
std.typecons.__T10RefCountedTS3std9container30__T5ArrayTS3std6bigint6BigIntZ5Array7PayloadVE3std8typecons24RefCountedAutoInitialize0Z.RefCounted.__dtor()
+ 38
9   x                                   0x00004407 void
std.container.Array!(std.bigint.BigInt).Array.__fieldDtor() + 11
10  x                                   0x00001f66 int x.foo() + 310
11  x                                   0x00001e27 _Dmain + 11
12  x                                   0x000211ef extern (C) int
rt.dmain2.main(int, char**).void runMain() + 23
13  x                                   0x00020d99 extern (C) int
rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 29
14  x                                   0x00021237 extern (C) int
rt.dmain2.main(int, char**).void runAll() + 59
15  x                                   0x00020d99 extern (C) int
rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 29
16  x                                   0x00020d33 main + 179
17  x                                   0x00001e11 start + 53
18  ???                                 0x00000001 0x0 + 1
----------------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 14 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5998


zetetyck gmail.com changed:

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



*** Issue 6959 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: -------
Nov 16 2011