Thread overview
[Issue 4254] New: addMod assertion failure
May 31, 2010
Ellery Newcomer
[Issue 4254] ICE(mtype.c): function with const inout parameter
Nov 02, 2010
Don
Nov 07, 2010
Walter Bright
May 31, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4254

           Summary: addMod assertion failure
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: ellery-newcomer@utulsa.edu


--- Comment #0 from Ellery Newcomer <ellery-newcomer@utulsa.edu> 2010-05-30 17:02:55 PDT ---
The code:

void bub(const inout int other) {}
void main() {
    bub(1);
}

The result:

dmd: mtype.c:1155: Type* Type::addMod(unsigned int): Assertion `0' failed.
/home/ellery/bin/dmd: line 3: 25241 Aborted                 (core dumped)
/home/ellery/Downloads/dmd2046/linux/bin/dmd $*

dmd  2.046

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


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-01 18:50:04 PDT ---
In mtype.c,
Type::addstorageclass() can result in any combination of const, shared, wild.
But not all possible combinations are considered in Type::addmod.
The missing cases are MODconst | MODwild and MODshared | MODconst | MODwild.
Apparently, if both const and wild are present, wild should be ignored.

So, Type::addStorageClass(), line 1180 should have 'else' added, to make MODconst and MODwild mutually exclusive:


    if (stc & STCimmutable)
        mod = MODimmutable;
    else
    {   if (stc & (STCconst | STCin))
            mod = MODconst;
-        if (stc & STCwild)
+        else if (stc & STCwild)
            mod = MODwild;
        if (stc & STCshared)
            mod |= MODshared;
    }

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


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-11-07 13:45:21 PST ---
http://www.dsource.org/projects/dmd/changeset/740

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