Hi,
gcc (for a STRICT_ALIGNMENT target and with -Wcast-align) do not warn
about the increasing of alignment requirement on the pointer assignments
present on the following C code.
struct {
short var;
} __attribute__((packed)) str;
void fun(void)
{
short *ptr;
ptr = (short *) (&str.var);
ptr = &str.var;
}
Is this the expected behavior in this case?
I don't think so. And I guess gcc is missing it by trusting the type's
(short) alignment requirement instead of the variable's (str.var
requires just byte-alignment).
Does anyone think this is an issue?
Regards,
--
Pedro Pedruzzi