Evan Jones <evanj@xxxxxxx> writes: > It is easy enough to work around this warning by assigning to void* > first. However, why does GCC think that struct sockaddr and struct > sockaddr_in have different alignment requirements? They are both 16 > bytes long. If you create an array of the two types, the elements are > packed without any padding. Thus, it seems like GCC thinks they have > the *same* alignment requirements in arrays, but different > requirements in pointers? I don't get it. Is this a bug? The size of the type does not describe the required alignment of the type. If, say, struct sockaddr is defined as { char x[16]; } then the size is 16 but it may be aligned on any 8-bit boundary. If, say, struct sockaddr_in has fields of type short or int, then the size may be 16 but it may require alignment on a 16-bit or 32-bit boundary. The same applies to an array of these types: an array of sockaddr may require 8-bit alignment while an array of sockaddr_in may require 32-bit alignment, independently of the overall size of the array. I don't know what the actual definitions of these structs are on your system. Ian