consistently give the following output on Windows Pike 8.0.182
[...]
but works as expected on Windows Pike 8.0.358.
Did you mix the numbers up? Otherwise it would seem that the issue has already been fixed?
Looks like an optimizer bug, although isn't the optimizable variant the one which gives the correct result?