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 12:01:54 -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 12:01 -------
> Reading your reply further, I understand that the behavior I observere is
> correct and related to the fact that the 'int32_t' type is assumed to be
> aligned.
Right.
> It is not a bug then, but merely a bit of a problem for me. Is there a
> typecast to tell the compiler that the adress references an unaligned
> integer, i.e. something like int32_unaligned_t?
'Fraid not. The "packed" attribute can't be applied to scalars
(and would in any case interfere a bit with the type system).
I think the best you can do is define a packed struct containing
a single int32_t field. Yes, it will clutter the code a bit,
but it will be type-safe.
Richard
--
What |Removed |Added
----------------------------------------------------------------------------
Status|SUSPENDED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21387