Thanks, Mitsuharu, for the diagnosis; I think you nailed it. Dmitry, I spotted a couple of problems with that patch. First, any compiler could do that optimization and I wouldn't be surprised if some version of GCC does it either now or in the future, so the fix shouldn't be conditionalized on __clang__. Second, making 'directory' itself volatile would break the (uncommon) case where GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS, because one can't portably assign the address of a volatile to a pointer that isn't volatile-qualified. Plus, there's no need to have every access to that local be volatile; we need only ensure that the value is stored somewhere. I installed the attached patch as emacs-24 bzr 117421, as a change that should not break anything and most likely fixes the bug. Please let me know how it works in the Clang environment.