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


--- Comment #0 from Fawzi Mohamed <fawzi gmx.ch> 2009-10-01 08:05:44 PDT ---
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


--- Comment #1 from Don <clugdbug yahoo.com.au> 2009-10-01 08:11:41 PDT ---
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


--- Comment #2 from Fawzi Mohamed <fawzi gmx.ch> 2009-10-01 08:21:28 PDT ---
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


--- Comment #3 from Don <clugdbug yahoo.com.au> 2009-10-01 08:33:01 PDT ---
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



--- Comment #4 from Fawzi Mohamed <fawzi gmx.ch> 2009-10-01 08:35:40 PDT ---
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


--- Comment #5 from Don <clugdbug yahoo.com.au> 2009-10-06 00:26:37 PDT ---
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


--- Comment #6 from Walter Bright <bugzilla digitalmars.com> 2009-10-13
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