This error happened only with O2 or O3 in my tests. Casting to uintptr_t and back seems to quiet the compiler.