http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49413
--- Comment #5 from Matt Gattis <gattis at gmail dot com> 2011-06-15 01:10:35 UTC --- (In reply to comment #1) > I think this code is undefined as the alignment requirements of double is 8 > bytes but the original (t->xyz->va/t->xyz->vb) is packed so it has a alignment > of 4 bytes. Isn't the only reason to use a packed struct to be able to squeeze misaligned data together and have it all work? My understanding is that GCC is supposed to automatically take care of the alignment using extra instructions. And it does, except when I turn more optimizations on. For some added context, I am mmap'ing a large file with the data packed in that struct format. Are you saying the only way I would get "defined" behavior from GCC is if I referenced xyz->va[i] every access, instead of assigning a temp variable to xyz->va?