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);
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);
2.069.2 gives "Error: cannot interpret <continue> at compile time", which is at least not an ICE. git head (6cd7173) gives "core.exception.AssertError@dinterpret.d(1008): Assertion failure", making this a diagnostic regression. Further reduced test case: ---- static assert({ bigone: foreach (l; [0]) continue bigone; return true; }()); ----
Nice, thanks. Hmmm, I was running v2.068.2. So should we qualify this as silently fixed?
Oh wait, the HEAD doesn't work either (albeit with a different diagnostic). So this bug stands. Thanks!
(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 "core.exception.AssertError@dinterpret.d(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.
https://github.com/D-Programming-Language/dmd/pull/5312
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/7d477b5be6e174a529fbeffceb61593624201897 Reboot #5312: fix Issue 15450 - ICE during CTFE of legit function https://github.com/D-Programming-Language/dmd/commit/a540e39b75fc02b91fe448f52e242db5765723e3 Merge pull request #5336 from WalterBright/reboot5313 Reboot #5312: fix Issue 15450 - ICE during CTFE of legit function
Commits pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/7d477b5be6e174a529fbeffceb61593624201897 Reboot #5312: fix Issue 15450 - ICE during CTFE of legit function https://github.com/D-Programming-Language/dmd/commit/a540e39b75fc02b91fe448f52e242db5765723e3 Merge pull request #5336 from WalterBright/reboot5313