[Issue 5131] Segfault(expression.c) opAssign and associative arrays (AA) are broken for types != this

2010-11-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5131


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||FIXED


--- Comment #2 from Walter Bright bugzi...@digitalmars.com 2010-11-07 
17:46:04 PST ---
http://www.dsource.org/projects/dmd/changeset/743

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


[Issue 5131] Segfault(expression.c) opAssign and associative arrays (AA) are broken for types != this

2010-10-31 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5131


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

   Keywords||patch


--- Comment #1 from Don clugd...@yahoo.com.au 2010-10-31 00:58:35 PDT ---
With  val[key] = e2, the temporary variable needs to be of typeof(val), not
typeof(e2).
PATCH:
expression.c, AssignExp::semantic(), line 8974.

Expression *e = op_overload(sc);
if (e  e1-op == TOKindex 
((IndexExp *)e1)-e1-type-toBasetype()-ty == Taarray)
{
// Deal with AAs (Bugzilla 2451)
// Rewrite as:
-// e1 = (typeof(e2) tmp = void, tmp = e2, tmp);
+// e1 = (typeof(aa.value) tmp = void, tmp = e2, tmp);
+Type * aaValueType = ((TypeAArray *)((IndexExp
*)e1)-e1-type-toBasetype())-next;
Identifier *id = Lexer::uniqueId(__aatmp);
-VarDeclaration *v = new VarDeclaration(loc, e2-type,
id, new VoidInitializer(NULL));
+VarDeclaration *v = new VarDeclaration(loc, aaValueType,
id, new VoidInitializer(NULL));
v-storage_class |= STCctfe;

Expression *de = new DeclarationExp(loc, v);
VarExp *ve = new VarExp(loc, v);

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