Thread overview
[Issue 1934] New: yet another Internal error: ..\ztc\cod1.c 2529
Mar 20, 2008
d-bugmail
May 08, 2009
d-bugmail
[Issue 1934] ICE(e2ir.c) using static array as AA key
Sep 13, 2009
Don
Sep 14, 2009
Don
Oct 01, 2009
Fawzi Mohamed
Oct 06, 2009
Don
Oct 13, 2009
Walter Bright
March 20, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1934

           Summary: yet another Internal error: ..\ztc\cod1.c 2529
           Product: D
           Version: 2.012
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: davidl@126.com


http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=67928

He mentioned that static array can't be used as AA keys. So I tested with the newest DMD:

void main()
{
    char[char[3]] k;
    k["dfs"]='a';
}

fails with msg:
Internal error: ..\ztc\cod1.c 2529


-- 

May 08, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1934


clugdbug@yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ellery-newcomer@utulsa.edu




------- Comment #1 from clugdbug@yahoo.com.au  2009-05-08 04:58 -------
*** Bug 2502 has been marked as a duplicate of this bug. ***


-- 

September 13, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1934


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.012                       |1.020
            Summary|ICE(cod1.c) using static    |ICE(e2ir.c) using static
                   |array as AA key             |array as AA key


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2009-09-13 11:37:06 PDT ---
The original version for this bug report was 2.012, and in both D1 and D2, it
used to ICE in cod1.c. (Test cases also ICEs in 1.020). It was fixed in
DMD2.026, but not listed in the changelog and not fixed in D1. In recent
versions of D1, it ICEs in e2ir.c.
I've changed compiler version and title accordingly.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 14, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1934


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #3 from Don <clugdbug@yahoo.com.au> 2009-09-14 07:53:33 PDT ---
Actually in D2 it doesn't ICE, but it generates incorrect code, because of bug 2954. D2 needs this patch, as well as a fix to bug 2954.

The ICE is because e2->elem() turns the string literal into a TYarray, instead of a TYsarray, so the length is lost. This patch restores it in the case where a fixed-length array is used.

PATCH against DMD1.047.

===================================================================
--- e2ir.c    (revision 192)
+++ e2ir.c    (working copy)
@@ -4020,10 +4020,15 @@

     // n2 becomes the index, also known as the key
     n2 = e2->toElem(irs);
-    if (n2->Ety == TYstruct || n2->Ety == TYarray)
+    if (tybasic(n2->Ety) == TYstruct || tybasic(n2->Ety) == TYarray)
     {
         n2 = el_una(OPstrpar, TYstruct, n2);
         n2->Enumbytes = n2->E1->Enumbytes;
+        if (taa->index->ty==Tsarray)
+        {
+        assert(e2->type->size() == taa->index->size());
+        n2->Enumbytes = taa->index->size();
+        }
         //printf("numbytes = %d\n", n2->Enumbytes);
         assert(n2->Enumbytes);
     }
=========
TEST CASE (still fails on D2):

void main()
{
    char[char[3]] ac;
    char[3] c = "abc";
    ac["abc"]='a';
    assert(ac[c]=='a');

    char[dchar[3]] ad;
    dchar[3] d = "abc"d;
    ad["abc"d]='a';
    assert(ad[d]=='a');
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 01, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1934


Fawzi Mohamed <fawzi@gmx.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fawzi@gmx.ch


--- Comment #4 from Fawzi Mohamed <fawzi@gmx.ch> 2009-10-01 08:21:28 PDT ---
*** Issue 3357 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 06, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1934



--- Comment #5 from Don <clugdbug@yahoo.com.au> 2009-10-06 00:28:16 PDT ---
The patch for bug 3357 should be applied at the same time, it's the other half
of the same issue (the fix needs to be applied to opIn() as well as opIndex()).

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


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #6 from Walter Bright <bugzilla@digitalmars.com> 2009-10-13 13:50:51 PDT ---
Fixed dmd 1.049

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