patch: honor volatile bitfield types
DJ Delorie
dj@redhat.com
Tue Jun 15 02:40:00 GMT 2010
> And, the field name should definitely be mentioned if at all
> possible.
Sigh, not possible without major code changes. This is the problem I
ran into writing the patch itself - the decls are all long since lost
by the time we get to these routines, and some of the paths that lead
to them make it very difficult to keep track of them (if they're
available at all).
How's this for the message?
if (bitsize == total_bits)
warning (0, "mis-aligned access used for structure member");
else
warning (0, "mis-aligned access used for structure bitfield");
if (! warned_about_misalignment)
{
warned_about_misalignment = true;
warning (0, "volatile objects require a single access to preserve their"
" volatility, but this member spans multiple type-sized locations."
" Normally the compiler would use multiple accesses for such fields"
" to avoid mis-aligned accesses. This code may fail at runtime")
}
More information about the Gcc-patches
mailing list