This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/29938] [3.4.4/3.4.6/4.1.1] ARM structure pointer alignment problem with optimization
- From: "rearnsha at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Nov 2006 10:50:42 -0000
- Subject: [Bug c/29938] [3.4.4/3.4.6/4.1.1] ARM structure pointer alignment problem with optimization
- References: <bug-29938-10531@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from rearnsha at gcc dot gnu dot org 2006-11-22 10:50 -------
The compiler expects 'y' to be correctly aligned because the ABI says that it
can expect this to be so. If you write a program that then provides an
unaligned value, then the behaviour is undefined and you can get any result the
compiler feels like giving you.
Hint: don't increment void* pointers (it's a gcc extension that permits this
anyway) and then try to assign them to a structure. Malloc provides memory
that is correctly aligned for direct assignment to any structure type.
--
rearnsha at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29938