This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: target/7815: ARM Bug
- From: Richard Earnshaw <rearnsha at cambridge dot arm dot com>
- To: "Matt Kuenzel" <matt at mapopolis dot com>
- Cc: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
- Date: Tue, 03 Sep 2002 13:27:23 +0100
- Subject: Re: target/7815: ARM Bug
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
>
> Hi,
>
> Thanks for the explanation. But shouldn't gcc know that=20
>
> ldr r0, [r3, #2]
>
> will try to read a 32-bit word at a non 32-bit boundary thus causing an =
> alignment fault?
You only get code that is safe from alignment traps if you compile with
-malignment-traps.
>
> Shouldn't it use the ldrh (load halfword) instruction?
For that you need -march=armv4
R.
Note that armv4 code will never generate alignment traps since it has no
need to generate unaligned memory instructions.