www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9843] New: DMD segfaults after error message

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

           Summary: DMD segfaults after error message
           Product: D
           Version: D2
          Platform: x86
        OS/Version: All
            Status: NEW
          Keywords: ice
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: mk krej.cz


--- Comment #0 from Martin Krejcirik <mk krej.cz> 2013-03-30 19:20:57 PDT ---
module something;
import std.stdio;

struct ArgTest1
{
    int itemid;
    int number;
}

struct ArgTest2
{
    string userid;
    int[] items;
}

union Argument
{
    int             nul;
    ArgTest1        test1;
    ArgTest2        test2;
}

struct TestSt
{
    Argument _arg = { nul : 0 };

    this(ArgTest1 a) { }

}

class Something
{
    immutable TestSt foo;

    this()
    {
        foo = TestSt(ArgTest1(1,2));
    }
    void dowork()
    {
        writeln( foo );
    }
}

dmd -c something.d

something.d(40): Error: cannot implicitly convert expression ((TestSt
__ctmp1218 = _D9something6TestSt6__initZ; , __ctmp1218).this(ArgTest1(1, 2)))
of type TestSt to immutable(TestSt)
Segmentation fault

dmd 2.062 32bit Linux/Windows

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


bearophile_hugs eml.cc changed:

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


--- Comment #1 from bearophile_hugs eml.cc 2013-03-30 20:05:38 PDT ---
A little reduced, but I don't know if the bug is the same:


import std.stdio: writeln;
struct Foo {
    int[] items;
}
union Bar {
    int nul;
    Foo test;
}
struct Spam {
    Bar b = {nul : 0};
}
void main() {
    immutable Spam s;
    writeln(s);
}

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


Martin Krejcirik <mk krej.cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|DMD segfaults after error   |DMD segfaults on code
                   |message                     |involving struct and union
                   |                            |with initialization
           Severity|minor                       |normal


--- Comment #2 from Martin Krejcirik <mk krej.cz> 2013-03-31 05:15:36 PDT ---
Seems same to me, changing description.

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


Martin Krejcirik <mk krej.cz> changed:

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


--- Comment #3 from Martin Krejcirik <mk krej.cz> 2013-06-01 13:15:42 CEST ---
This bug disappeared in dmd 2.063.

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