In C++ we have such troubles either. If something looking as constant cannot be 100% proved to be a constant, it cannot be optimized.

> Incrementing vectors (26.08.2019)

https://news.ycombinator.com/item?id=20800076