https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66086
--- Comment #3 from Andrea Griffini <agriff at tin dot it> --- The problem remains even storing the intermediate result to a named variable (not really surprising)... uintptr_t ip = (uintptr_t)ptr; return (double)ip; but of course goes away if storing the pointer to a global variable.