https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91205
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org --- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> --- (In reply to Ricardo Ribalda from comment #5) The rule is to respect object and subobject boundaries. I.e., except for elements of the same array, don't assume that a pointer one object (or subobject) can be used to derive a pointer to another object (or suobject), even an immediately adjacent one, or that such a pointer can be used to access the adjacent object. To get from subobject A to subobject B within the same enclosing object X, start with a pointer to X rather that with one to X.A, and increment it by the difference between the offsets of two subobjects. GCC implements weaker rules for memcpy to try to accommodate code the doesn't respect this rule but that comes at the cost of compromised buffer overflow detection (i.e., warnings) and protection (_FORTIFY_SOURCE).