Thread overview
[Issue 5025] New: DMD: Assertion 't->mod == 4' failed in cast.c
Oct 09, 2010
Ivo Kasiuk
[Issue 5025] ICE(cast.c) shared struct literal
Nov 29, 2010
Don
Dec 27, 2010
Walter Bright
October 09, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5025

           Summary: DMD: Assertion 't->mod == 4' failed in cast.c
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: i.kasiuk@gmx.de


--- Comment #0 from Ivo Kasiuk <i.kasiuk@gmx.de> 2010-10-09 10:18:10 PDT ---
Assertion failure during compilation with DMD v2.049:

$ cat test.d
struct S {
  void delegate() d;
}
void main() {
  shared S[] s;
  s[0] = S();
}
$ dmd test
dmd: cast.c:432: virtual MATCH StructLiteralExp::implicitConvTo(Type*):
Assertion `t->mod == 4' failed.
Aborted

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 29, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5025


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
         OS/Version|Linux                       |All


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2010-11-29 07:20:25 PST ---
Applies to any struct which contains a non-trivial type: delegate, pointer,
class, or dynamic array.
There are a few other cases where it applies, not just shared.
---
struct Bug5025 {
    int[] d;
}

shared Bug5025 b5025 = Bug5025();

const shared Bug5025 b5025a = Bug5025();

inout(Bug5025) bug5025c(inout Bug5025 xxx)
{
    return Bug5025();
}
-----------
PATCH
cast.c line 429.
-----------


        m = MATCHconst;
        for (int i = 0; i < elements->dim; i++)
        {   Expression *e = (Expression *)elements->data[i];
            Type *te = e->type;

-            if (t->mod == 0)
-                te = te->mutableOf();
-            else
-            {   assert(t->mod == MODimmutable);
-                te = te->invariantOf();
-            }

+            te = te->castMod(t->mod);

            MATCH m2 = e->implicitConvTo(te);
            //printf("\t%s => %s, match = %d\n", e->toChars(), te->toChars(),
m2);
            if (m2 < m)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 27, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5025


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2010-12-27 14:22:15 PST ---
http://www.dsource.org/projects/dmd/changeset/822

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