https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93910

--- Comment #3 from stephane.goujet at wanadoo dot fr ---
 (In reply to Mikael Pettersson from comment #2)

> IMO the warning is correct.  Simply _creating_ a misaligned pointer is
> undefined behaviour, and there are machines where it cannot be done without
> losing precision.  void* / char* is the only pointer type that can point to
> any object.

(In reply to Andreas Schwab from comment #1)
> You are still converting an unaligned pointer to an aligned pointer, and the
> address of a struct is the same as the address if its first member (with
> suitable conversion).


Why would the address of the struct be misaligned?

The members which are inside a packed struct can be misaligned. The struct
itself is normally aligned, it is not in packed container of some sort.

Reply via email to