Commit a1543fb1 by Iain Buclaw Committed by Iain Buclaw

re PR d/90650 (ICE in fold_convert_loc, at fold-const.c:2552)

	PR d/90650
d/dmd: Merge upstream dmd ab03e2918

Fixes internal compiler error in fold_convert_loc.

Reviewed-on: https://github.com/dlang/dmd/pull/9996

gcc/testsuite/ChangeLog:

2019-06-16  Iain Buclaw  <ibuclaw@gdcproject.org>

	PR d/90650
	* gdc.dg/pr90650a.d: New test.
	* gdc.dg/pr90650b.d: New test.

From-SVN: r272344
parent 70106db9
f30c5dc790c17914463879157447acc671518735 ab03e2918508d62efcc5ee66c9a912a331b33aa0
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository. merge done from the dlang/dmd repository.
...@@ -2185,6 +2185,9 @@ public: ...@@ -2185,6 +2185,9 @@ public:
} }
if (exp->e1->op == TOKslice || exp->e1->type->ty == Tarray || exp->e1->type->ty == Tsarray) if (exp->e1->op == TOKslice || exp->e1->type->ty == Tarray || exp->e1->type->ty == Tsarray)
{ {
if (checkNonAssignmentArrayOp(exp->e1))
return setError();
if (exp->e1->op == TOKslice) if (exp->e1->op == TOKslice)
((SliceExp *)exp->e1)->arrayop = true; ((SliceExp *)exp->e1)->arrayop = true;
...@@ -6232,6 +6235,9 @@ public: ...@@ -6232,6 +6235,9 @@ public:
assert(exp->e1->type && exp->e2->type); assert(exp->e1->type && exp->e2->type);
if (exp->e1->op == TOKslice || exp->e1->type->ty == Tarray || exp->e1->type->ty == Tsarray) if (exp->e1->op == TOKslice || exp->e1->type->ty == Tarray || exp->e1->type->ty == Tsarray)
{ {
if (checkNonAssignmentArrayOp(exp->e1))
return setError();
// T[] ^^= ... // T[] ^^= ...
if (exp->e2->implicitConvTo(exp->e1->type->nextOf())) if (exp->e2->implicitConvTo(exp->e1->type->nextOf()))
{ {
......
...@@ -4468,6 +4468,8 @@ Expression *TypeDArray::dotExp(Scope *sc, Expression *e, Identifier *ident, int ...@@ -4468,6 +4468,8 @@ Expression *TypeDArray::dotExp(Scope *sc, Expression *e, Identifier *ident, int
} }
if (e->op == TOKnull) if (e->op == TOKnull)
return new IntegerExp(e->loc, 0, Type::tsize_t); return new IntegerExp(e->loc, 0, Type::tsize_t);
if (checkNonAssignmentArrayOp(e))
return new ErrorExp();
e = new ArrayLengthExp(e->loc, e); e = new ArrayLengthExp(e->loc, e);
e->type = Type::tsize_t; e->type = Type::tsize_t;
return e; return e;
......
...@@ -95,6 +95,8 @@ public: ...@@ -95,6 +95,8 @@ public:
s->exp = semantic(s->exp, sc); s->exp = semantic(s->exp, sc);
s->exp = resolveProperties(sc, s->exp); s->exp = resolveProperties(sc, s->exp);
s->exp = s->exp->addDtorHook(sc); s->exp = s->exp->addDtorHook(sc);
if (checkNonAssignmentArrayOp(s->exp))
s->exp = new ErrorExp();
if (FuncDeclaration *f = isFuncAddress(s->exp)) if (FuncDeclaration *f = isFuncAddress(s->exp))
{ {
if (f->checkForwardRef(s->exp->loc)) if (f->checkForwardRef(s->exp->loc))
...@@ -370,6 +372,8 @@ public: ...@@ -370,6 +372,8 @@ public:
ds->condition = semantic(ds->condition, sc); ds->condition = semantic(ds->condition, sc);
ds->condition = resolveProperties(sc, ds->condition); ds->condition = resolveProperties(sc, ds->condition);
if (checkNonAssignmentArrayOp(ds->condition))
ds->condition = new ErrorExp();
ds->condition = ds->condition->optimize(WANTvalue); ds->condition = ds->condition->optimize(WANTvalue);
ds->condition = checkGC(sc, ds->condition); ds->condition = checkGC(sc, ds->condition);
...@@ -440,6 +444,8 @@ public: ...@@ -440,6 +444,8 @@ public:
fs->condition = semantic(fs->condition, sc); fs->condition = semantic(fs->condition, sc);
fs->condition = resolveProperties(sc, fs->condition); fs->condition = resolveProperties(sc, fs->condition);
if (checkNonAssignmentArrayOp(fs->condition))
fs->condition = new ErrorExp();
fs->condition = fs->condition->optimize(WANTvalue); fs->condition = fs->condition->optimize(WANTvalue);
fs->condition = checkGC(sc, fs->condition); fs->condition = checkGC(sc, fs->condition);
fs->condition = fs->condition->toBoolean(sc); fs->condition = fs->condition->toBoolean(sc);
...@@ -450,6 +456,8 @@ public: ...@@ -450,6 +456,8 @@ public:
((CommaExp *)fs->increment)->allowCommaExp = true; ((CommaExp *)fs->increment)->allowCommaExp = true;
fs->increment = semantic(fs->increment, sc); fs->increment = semantic(fs->increment, sc);
fs->increment = resolveProperties(sc, fs->increment); fs->increment = resolveProperties(sc, fs->increment);
if (checkNonAssignmentArrayOp(fs->increment))
fs->increment = new ErrorExp();
fs->increment = fs->increment->optimize(WANTvalue); fs->increment = fs->increment->optimize(WANTvalue);
fs->increment = checkGC(sc, fs->increment); fs->increment = checkGC(sc, fs->increment);
} }
...@@ -1723,6 +1731,8 @@ public: ...@@ -1723,6 +1731,8 @@ public:
ifs->condition = resolveProperties(sc, ifs->condition); ifs->condition = resolveProperties(sc, ifs->condition);
ifs->condition = ifs->condition->addDtorHook(sc); ifs->condition = ifs->condition->addDtorHook(sc);
} }
if (checkNonAssignmentArrayOp(ifs->condition))
ifs->condition = new ErrorExp();
ifs->condition = checkGC(sc, ifs->condition); ifs->condition = checkGC(sc, ifs->condition);
// Convert to boolean after declaring prm so this works: // Convert to boolean after declaring prm so this works:
...@@ -1971,6 +1981,8 @@ public: ...@@ -1971,6 +1981,8 @@ public:
break; break;
} }
} }
if (checkNonAssignmentArrayOp(ss->condition))
ss->condition = new ErrorExp();
ss->condition = ss->condition->optimize(WANTvalue); ss->condition = ss->condition->optimize(WANTvalue);
ss->condition = checkGC(sc, ss->condition); ss->condition = checkGC(sc, ss->condition);
if (ss->condition->op == TOKerror) if (ss->condition->op == TOKerror)
......
2019-06-15 Iain Buclaw <ibuclaw@gdcproject.org>
PR d/90650
* gdc.dg/pr90650a.d: New test.
* gdc.dg/pr90650b.d: New test.
2019-06-15 Steven G. Kargl <kargl@gcc.gnu.org> 2019-06-15 Steven G. Kargl <kargl@gcc.gnu.org>
* gfortran.dg/dummy_derived_typed.f90: New test. * gfortran.dg/dummy_derived_typed.f90: New test.
......
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90650
// { dg-do compile }
class c
{
static f ()
{
return 0;
}
}
void g ()
{
if (0 & [0] & c.f()) {} // { dg-error "array operation \\\[0\\\] & 0 & f\\(\\) without destination memory not allowed" }
}
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90650
// { dg-do compile }
class c
{
static f ()
{
return 0;
}
}
void g ()
{
if ([0] & c.f()) {} // { dg-error "array operation \\\[0\\\] & f\\(\\) without destination memory not allowed" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment