Repro below fails with:
dmd: interpret.c:1034: Expression* interpret(FuncDeclaration*, InterState*, Expressions*, Expression*): Assertion `!e || (e->op != TOKcontinue && e->op != TOKbreak)' failed.
====================
struct BigO
{
struct Atom
{
int id;
double exp;
double logExp;
}
private Atom[][] terms;
int opCmp(const BigO rhs) const
{
int result = 0;
bigone:
foreach (ref l; terms)
{
foreach (ref r; rhs.terms)
{
if (l == r) continue bigone;
if (smaller(l, r))
{
if (result == 1) return 0;
if (result == 0) result = -1;
continue bigone;
}
if (smaller(r, l))
{
if (result == -1) return 0;
if (result == 0) result = 1;
continue bigone;
}
}
// Not comparable
return 0;
}
return result;
}
private static bool smaller(const(Atom)[] lhs, const(Atom)[] rhs)
{
return 0;
}
}
static immutable
linear = BigO([ [ BigO.Atom(0, 1, 0) ] ]);
static assert(linear >= linear);
Comment #1 by andrei — 2015-12-15T23:01:37Z
Shorter repro. It's the labeled continue that's the problem:
struct BigO
{
struct Atom
{
int id;
double exp;
double logExp;
}
private Atom[][] terms;
int opCmp(const BigO rhs) const
{
int result = 0;
bigone:
foreach (ref l; terms)
{
foreach (ref r; rhs.terms)
{
continue bigone;
}
}
return result;
}
}
static immutable
linear = BigO([ [ BigO.Atom(0, 1, 0) ] ]);
static assert(linear >= linear);
Comment #2 by ag0aep6g — 2015-12-15T23:21:51Z
2.069.2 gives "Error: cannot interpret <continue> at compile time", which is at least not an ICE.
git head (6cd7173) gives "[email protected](1008): Assertion failure", making this a diagnostic regression.
Further reduced test case:
----
static assert({
bigone: foreach (l; [0]) continue bigone;
return true;
}());
----
Comment #3 by andrei — 2015-12-15T23:53:38Z
Nice, thanks. Hmmm, I was running v2.068.2. So should we qualify this as silently fixed?
Comment #4 by andrei — 2015-12-15T23:54:53Z
Oh wait, the HEAD doesn't work either (albeit with a different diagnostic). So this bug stands. Thanks!
Comment #5 by k.hara.pg — 2015-12-16T14:11:28Z
(In reply to ag0aep6g from comment #2)
> 2.069.2 gives "Error: cannot interpret <continue> at compile time", which is
> at least not an ICE.
>
> git head (6cd7173) gives "[email protected](1008):
> Assertion failure", making this a diagnostic regression.
From 2.069.0, released dmd binary is compiled with -release, so all of internal asserts won't hit.
Note that, ICE also happens with 2.068, like:
Assertion failure: '!e || (e->op != TOKcontinue && e->op != TOKbreak)' on line 1034 in file 'interpret.c'
abnormal program termination
Therefore, this is not a regression from 2.069.