[Issue 13434] [ICE] indexing array with empty tuple causes dmd segfault
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Sep 6 19:03:44 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13434
hsteoh at quickfur.ath.cx changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
--- Comment #1 from hsteoh at quickfur.ath.cx ---
This patch fixes it:
-------
diff --git a/src/expression.c b/src/expression.c
index 9b8b80b..650f67a 100644
--- a/src/expression.c
+++ b/src/expression.c
@@ -10336,8 +10336,11 @@ Expression *IndexExp::semantic(Scope *sc)
if (t1->ty == Ttuple) sc = sc->endCTFE();
if (e2->type == Type::terror)
return new ErrorExp();
- if (e2->type->ty == Ttuple && ((TupleExp *)e2)->exps->dim == 1) // bug
4444 fix
+ if (e2->type->ty == Ttuple && ((TupleExp *)e2)->exps &&
+ ((TupleExp *)e2)->exps->dim == 1) // bug 4444 fix
+ {
e2 = (*((TupleExp *)e2)->exps)[0];
+ }
if (t1->ty == Tsarray || t1->ty == Tarray || t1->ty == Ttuple)
sc = sc->pop();
-------
Will submit this as a PR on Monday once internet connectivity from my home PC
is restored.
--
More information about the Digitalmars-d-bugs
mailing list