This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/21387] Unaligned writes on MIPSEL systems after typecast
- From: "rsandifo at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 May 2005 07:11:55 -0000
- Subject: [Bug target/21387] Unaligned writes on MIPSEL systems after typecast
- References: <20050504190754.21387.maarten@contemplated.nl>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From rsandifo at gcc dot gnu dot org 2005-05-05 07:11 -------
I'm confused by this report. You use:
*((int32_t *) a.unaligned_int) = 0x123456;
which reads the value of a.unaligned_int, casts it from an integer
to a pointer, and then dereferences the pointer. Why do you expect
the store to be unaligned? There's no reason to assume that,
just because the address was stored in an unaligned location,
the thing it points to is also unaligned.
Did you mean to write &a.aligned_int instead? If so, then like
Andrew says, that's invalid. You can't access an unaligned object
(a.unaligned_int) as though it had an aligned type (int32_t).
Richard
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |rsandifo at gcc dot gnu dot
| |org
Status|UNCONFIRMED |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21387