This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/66086] Casting a pointer to an uintptr_t and later to a double confuses the optimizer
- From: "agriff at tin dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 10 May 2015 09:48:41 +0000
- Subject: [Bug c/66086] Casting a pointer to an uintptr_t and later to a double confuses the optimizer
- Auto-submitted: auto-generated
- References: <bug-66086-4 at http dot gcc dot gnu dot org/bugzilla/>
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.