This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: arm.md: arm_arch4 & LDRH vs LDRB
- To: jorky at mail dot ru
- Subject: Re: arm.md: arm_arch4 & LDRH vs LDRB
- From: Nick Clifton <nickc at cygnus dot com>
- Date: Thu, 18 May 2000 15:59:18 -0700
- CC: gcc at gcc dot gnu dot org
Hi Igor,
: I tried to compile following example:
:
: typedef unsigned short __attribute__ ((aligned(1))) *tpShort;
: tpShort qx;
:
: unsigned short i;
:
: void module1(void)
: {
: i = *qx;
: }
This will not work. The 'aligned' attribute can only be used to
increase the alignment of a type or variable, it cannot be used to
decrease it. Note, despite what the documentation in extend.texi may
imply, you cannot use the packed attribute to fix things up either.
Basically GCC does not (currently) support unaligned pointers.
If you have a situation where you belive that a pointer may be
unaligned you will have to code around it. A union with char and
short fields in it would be my recommendation.
Cheers
Nick