This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/49413] over-optimization that causes valid code to segfault
- From: "gattis at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 15 Jun 2011 01:10:41 +0000
- Subject: [Bug tree-optimization/49413] over-optimization that causes valid code to segfault
- Auto-submitted: auto-generated
- References: <bug-49413-4@http.gcc.gnu.org/bugzilla/>
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?