It is not a bug, the standard double-checked locking doesn't work due to massive changes to the compilers which is made for better performance and regardless of that, new servers are multiproccessor and they have changed their algorithm accessing the memory in terms of speed and performance.
The problem is visibility, which means, the time takes the changes made to a shared variable becomes visible to another thread is indefinite and making the variable volatile guarantees the visibility of modified data across the threads