This is the mail archive of the
mailing list for the GCC project.
Possible missing case for -Wcast-align
- From: Pedro Pedruzzi <pedro dot pedruzzi at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 30 Apr 2010 17:12:55 -0300
- Subject: Possible missing case for -Wcast-align
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.
} __attribute__((packed)) str;
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?