[Bug sanitizer/105141] #pragma pack(1) causes incorrect UBSAN warning
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Apr 3 20:52:18 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105141
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> int *d = &c.b;
int has an alignment requirement of 4 bytes but when you do this:
#pragma pack(1)
struct {
char a;
int b;
} c;
The alignment of c.b will be 1.
More information about the Gcc-bugs
mailing list