Comment #3 by matti.niemenmaa+dbugzilla — 2006-08-19T04:10:50Z
My reduced version, with some inline comments:
import std.stdio : writefln;
void main() {
int lng, lngnew;
int[] arr = new int[1];
for (int i = 10; i--;) {
// removing one of the pairs of assignments to lng/lngnew
// fixes the bug
lngnew = lng + arr.length;
lng = lngnew;
lngnew = lng + arr.length;
// moving this writefln to anywhere except between either pair
// of assignments to lng/lngnew fixes the bug
writefln("%2d %2d %2d", lng, lngnew, arr.length);
// changing either "lng = lngnew" to the equivalent statement
// "lng += arr.length" fixes the bug
lng = lngnew;
}
}