www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3357] New: ICE with aa that use static char array as key

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

           Summary: ICE with aa that use static char array as key
           Product: D
           Version: 1.047
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: fawzi gmx.ch



I was trying to reduce an error, namely
  Internal error: e2ir.c 4026
and I generated another one
{{{
struct Particle{
    char[16] name;
}

class ReadSystem{
    size_t[char[16]] pKindsIdx;

    void t(Particle p){
        auto idx=p.name in pKindsIdx; // fails (Internal error: ../ztc/cod1.c
2636)
    }
}

void main(){
    char[16] n;
    size_t[char[16]] aa;
    auto r=n in aa; // works
}
}}}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 01 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3357


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au



Is this the same as bug 1934?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 01 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3357


Fawzi Mohamed <fawzi gmx.ch> changed:

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



Yes it looks like it, the line number changed (probably due to changes in the
code) and I hadn't found it, but it really looks like the same issue.

*** This issue has been marked as a duplicate of issue 1934 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 01 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3357


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
             Status|RESOLVED                    |REOPENED
           Platform|Other                       |All
         Resolution|DUPLICATE                   |
         OS/Version|Mac OS X                    |All



This isn't the same as bug 1934, though it is clearly very closely related. My
patch for 1934 doesn't fix this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 01 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3357




thanks for catching it...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 01 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3357


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
            Summary|ICE with aa that use static |ICE(cod1.c) using 'in' with
                   |char array as key           |a static char array as AA
                   |                            |key



Same cause as bug 1934. The patch I used for IndexExp::toElem() also needs to 
be applied to InExp::toElem().

Index: e2ir.c
===================================================================
--- e2ir.c    (revision 75)
+++ e2ir.c    (working copy)
   -2391,6 +2391,13   
     key->Enumbytes = key->E1->Enumbytes;
     assert(key->Enumbytes);
     }
+    else if (tybasic(key->Ety) == TYarray && taa->index->ty==Tsarray)
+    {    // e2->elem() turns string literals into a TYarray, so the
+    // length is lost. Restore it.
+    key = el_una(OPstrpar, TYstruct, key);
+    assert(e1->type->size() == taa->index->size());
+    key->Enumbytes = taa->index->size();
+    }

     Symbol *s = taa->aaGetSymbol("In", 0);
     keyti = taa->index->getInternalTypeInfo(NULL)->toElem(irs);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 06 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3357


Walter Bright <bugzilla digitalmars.com> changed:

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



13:48:44 PDT ---
Fixed dmd 1.049 and 2.034

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