An ATOMIC_GET operation should be written and used.
In some cases rb_atomic_t types are retrieved without synchronization.
Most cases in the code seem very innocuous and unlikely to cause bugs
but an evil optimizing compiler could potentially do bad things
(especially with link time optimization). Now, the raw machine code
is probably going to be safe on architectures such as x86 but the
compiler might drag the code around and mess it up. A very easy
temporary solution might be to redefine rb_atomic_t to be volatile.
Technically, according to the C11 standard such accesses don't count
as synchronized or atomic but in practise that would prevent compilers
from moving accesses around. I would prefer if an ATOMIC_GET define
is made and used instead though.