https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95349
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Andrew Downing from comment #8) > From the C standard: > If a value is copied into an object having no declared type using memcpy or > memmove, or is copied as an array of character type, then the effective type > of the modified object for that access and for subsequent accesses that do > not modify the value is the effective type of the object from which the > value is copied, if it has one. For all other accesses to an object having > no declared type, the effective type of the object is simply the type of the > lvalue used for the access. > > So even using C semantics the effective type of storage and *t should not be > changed, because they already have a declared type. But in your testcases 't' is a pointer and the declared object is not visible. So the only thing an implementation can do is take advantage of the declared type for optimization when it is visible.