I apologize for the length of this test case, it was reduced from a ~1500 line file with a failing unittest. The following bug seems to be caused by DMD failing to increment i in the struct Perm. It only happens under -O -release -m64. Omitting any of these flags makes this program work. Also, the call to enforce() is necessary to reproduce the bug. import std.stdio; bool enforce(bool value, lazy const(char)[] msg = null) { if(!value) { return false; } return value; } struct Perm { byte[3] perm; ubyte i; this(byte[] input) { foreach(elem; input) { enforce(i < 3); perm[i++] = elem; stderr.writeln(i); // Never gets incremented. Stays at 0. } } } void main() { byte[] stuff = [0, 1, 2]; auto perm2 = Perm(stuff); writeln(perm2.perm); // Prints [2, 0, 0] assert(perm2.perm[] == [0, 1, 2]); }
https://github.com/D-Programming-Language/dmd/commit/64b9981229ee44b6126b96222936bd5c35be0e59 https://github.com/D-Programming-Language/dmd/commit/57eddad8d3484ee64736be21ddad1873365fc9b8
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル