[Issue 3357] ICE(cod1.c) using 'in' with a static char array as AA key
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Tue Oct  6 00:26:38 PDT 2009
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=3357
Don <clugdbug at 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 at 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: -------
    
    
More information about the Digitalmars-d-bugs
mailing list