https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93745
Alexander Monakov <amonakov at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amonakov at gcc dot gnu.org --- Comment #1 from Alexander Monakov <amonakov at gcc dot gnu.org> --- The store cannot be eliminated with GCC's memory model where stores through a pointer can change dynamic type. The extra load you mention can be optimized because if *p and d overlap, attempt to load from a 'double' stored value via an 'int *' would have invoked undefined behavior.