[Issue 12044] New: Invalid code gen causes segfault

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 30 13:40:06 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12044

           Summary: Invalid code gen causes segfault
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: jcrapuchettes at gmail.com


--- Comment #0 from Jonathan Crapuchettes <jcrapuchettes at gmail.com> 2014-01-30 13:40:00 PST ---
The following code example was tested with 2.063.2 and executes without error.
If compiled with 2.064.2 or 2.065.0-b2, the example compiles, but segfaults
when run.

In the example, commenting or changing most of the lines will allow 2.064.2+ to
produce code that does not segfault.

Backtrace output from gdb at point of segfault:
----------------
(gdb) bt
#0  0x000000000042d9eb in _d_arrayliteralTX ()
#1  0x0000000000429dcd in valid_sparse.main() (this=0x0) at valid_sparse.d:32
#2  0x000000000042a57f in valid_sparse.Test.__T8opBinaryVAyaa2_696eZ.opBinary()
(this=0x7fffffffdad8, fun=...) at valid_sparse.d:42
#3  0x0000000000429da2 in D main () at valid_sparse.d:26
#4  0x000000000042cf20 in rt.dmain2._d_run_main() ()
#5  0x000000000042ce7a in rt.dmain2._d_run_main() ()
#6  0x000000000042cee0 in rt.dmain2._d_run_main() ()
#7  0x000000000042ce7a in rt.dmain2._d_run_main() ()
#8  0x000000000042cdfb in _d_run_main ()
#9  0x000000000042ae25 in main ()

Example:
----------------
import std.array;
import std.traits;
import std.algorithm;

struct BasicNode(T) { T id; }
struct Hierarchy(Code)
{
    struct Node { Code id; }

    Node[] allNodes;

    bool opEquals(OtherH)(OtherH )
    {
        allNodes.map!("a.id").array;
    }
}

struct Test
{
    void opBinary(string op)(void delegate() fun)
    {
        fun();
    }
}

void main()
{
    Test() in
    {
        enum BlaEnum : ubyte { All }

        auto Blas = [EnumMembers!BlaEnum].map!(a => BasicNode!BlaEnum(a));

        Hierarchy!(BlaEnum) H_T;
    };
}

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


More information about the Digitalmars-d-bugs mailing list