Thanks, guys, for reducing it and for finding which PR caused it. Looks like the ball is in my court.
Comment #4 by bugzilla — 2015-07-27T07:35:04Z
Somewhat smaller test case that only requires -O to fail:
int decodeImpl(int[] str)
{
return 1;
}
int[] stripLeft(int[] str)
{
while (true)
{
int[] a = str;
int[] s = a;
int dc = decodeImpl(str);
str = str[1 .. $];
bool w = dc != 1;
if (!w) return s;
}
}
void main ()
{
int[1] a = 2;
assert (stripLeft(a)[0] == 2); // fails with -O
}
Comment #5 by bugzilla — 2015-07-27T19:46:20Z
Even smaller:
int stripLeft(int str, int dc)
{
while (true)
{
int a = str;
int s = a;
str += 1;
if (dc) return s;
}
}
void main ()
{
assert (stripLeft(3, 1) == 3); // fails with -O
}