Consider the following code (minimized example):
-----
void main () {
foreach (k; 32..33) {
if (1L & (1L << k)) {
assert (false);
}
}
}
-----
Obviously, 1L & (1L << k) must be true only when k = 0.
Still, with k = 32, it produces a true value when compiled with "dmd -O".
All is well without "-O".
It is reproducible for me with DMD 2.064.2-2.066.0 on Win32. It works for me with DMD 2.063.2. So, the issue was probably introduced between 2.063.2 and 2.064.2.
Comment #1 by gassa — 2014-08-27T13:48:40Z
Created attachment 1390
A small example demonstrating the problem.