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
This commit is contained in:
Iain Buclaw 2019-06-16 07:48:53 +00:00 committed by Iain Buclaw
parent 70106db926
commit a1543fb19b
7 changed files with 54 additions and 1 deletions

View File

@ -1,4 +1,4 @@
f30c5dc790c17914463879157447acc671518735
ab03e2918508d62efcc5ee66c9a912a331b33aa0
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.

View File

@ -2185,6 +2185,9 @@ public:
}
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)
((SliceExp *)exp->e1)->arrayop = true;
@ -6232,6 +6235,9 @@ public:
assert(exp->e1->type && exp->e2->type);
if (exp->e1->op == TOKslice || exp->e1->type->ty == Tarray || exp->e1->type->ty == Tsarray)
{
if (checkNonAssignmentArrayOp(exp->e1))
return setError();
// T[] ^^= ...
if (exp->e2->implicitConvTo(exp->e1->type->nextOf()))
{

View File

@ -4468,6 +4468,8 @@ Expression *TypeDArray::dotExp(Scope *sc, Expression *e, Identifier *ident, int
}
if (e->op == TOKnull)
return new IntegerExp(e->loc, 0, Type::tsize_t);
if (checkNonAssignmentArrayOp(e))
return new ErrorExp();
e = new ArrayLengthExp(e->loc, e);
e->type = Type::tsize_t;
return e;

View File

@ -95,6 +95,8 @@ public:
s->exp = semantic(s->exp, sc);
s->exp = resolveProperties(sc, s->exp);
s->exp = s->exp->addDtorHook(sc);
if (checkNonAssignmentArrayOp(s->exp))
s->exp = new ErrorExp();
if (FuncDeclaration *f = isFuncAddress(s->exp))
{
if (f->checkForwardRef(s->exp->loc))
@ -370,6 +372,8 @@ public:
ds->condition = semantic(ds->condition, sc);
ds->condition = resolveProperties(sc, ds->condition);
if (checkNonAssignmentArrayOp(ds->condition))
ds->condition = new ErrorExp();
ds->condition = ds->condition->optimize(WANTvalue);
ds->condition = checkGC(sc, ds->condition);
@ -440,6 +444,8 @@ public:
fs->condition = semantic(fs->condition, sc);
fs->condition = resolveProperties(sc, fs->condition);
if (checkNonAssignmentArrayOp(fs->condition))
fs->condition = new ErrorExp();
fs->condition = fs->condition->optimize(WANTvalue);
fs->condition = checkGC(sc, fs->condition);
fs->condition = fs->condition->toBoolean(sc);
@ -450,6 +456,8 @@ public:
((CommaExp *)fs->increment)->allowCommaExp = true;
fs->increment = semantic(fs->increment, sc);
fs->increment = resolveProperties(sc, fs->increment);
if (checkNonAssignmentArrayOp(fs->increment))
fs->increment = new ErrorExp();
fs->increment = fs->increment->optimize(WANTvalue);
fs->increment = checkGC(sc, fs->increment);
}
@ -1723,6 +1731,8 @@ public:
ifs->condition = resolveProperties(sc, ifs->condition);
ifs->condition = ifs->condition->addDtorHook(sc);
}
if (checkNonAssignmentArrayOp(ifs->condition))
ifs->condition = new ErrorExp();
ifs->condition = checkGC(sc, ifs->condition);
// Convert to boolean after declaring prm so this works:
@ -1971,6 +1981,8 @@ public:
break;
}
}
if (checkNonAssignmentArrayOp(ss->condition))
ss->condition = new ErrorExp();
ss->condition = ss->condition->optimize(WANTvalue);
ss->condition = checkGC(sc, ss->condition);
if (ss->condition->op == TOKerror)

View File

@ -1,3 +1,9 @@
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>
* gfortran.dg/dummy_derived_typed.f90: New test.

View File

@ -0,0 +1,14 @@
// 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" }
}

View File

@ -0,0 +1,13 @@
// 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" }
}