This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/24178] GCC 4.0/4.1 generates code that produces unaligned access exceptions
- From: "falk at debian dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Oct 2005 20:48:23 -0000
- Subject: [Bug middle-end/24178] GCC 4.0/4.1 generates code that produces unaligned access exceptions
- References: <bug-24178-3055@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from falk at debian dot org 2005-10-03 20:48 -------
(In reply to comment #0)
> The offset of "p5" member is 25 bytes, but compiler thinks that "p5" is aligned
> in "foo" function
You are casting a pointer to a Foo* that doesn't have proper alignment for
a Foo. This is undefined behavior, so anything can happen, including an
unaligned access at some later point. This is not a gcc bug.
> It might be not very good coding practice, but it taken from Mozilla source.
Please report it there instead.
--
falk at debian dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |falk at debian dot org
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24178