This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/49413] over-optimization that causes valid code to segfault


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]