[Issue 1934] ICE(e2ir.c) using static array as AA key
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Sep 14 07:53:34 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1934
Don <clugdbug at yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
--- Comment #3 from Don <clugdbug at 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: -------
More information about the Digitalmars-d-bugs
mailing list