On DMD32 D Compiler v2.089.0-dirty, Windows, the code

----
import std.stdio;

int f(int x) {
  return 1;
}

void main() {
  enum N = 100;
  auto a = new int[N];
  a[] = 1;
  long sum;
  foreach_reverse (i; 0 .. N) {
    const r = i % 5;
    sum += cast(long)(a[i]) * f(r);
  }
  writeln(sum);
}
----

gives the output 950, while it should be 100. This happens only with -O and without -m64 option.

I have encountered some kind of "32-bit / 64-bit issues" several times (https://issues.dlang.org/show_bug.cgi?id=20162, https://issues.dlang.org/show_bug.cgi?id=20128).

Reply via email to