This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Why does arm-*-as issue a warning for "strb r3, [r3], #1"?
- From: Ian Lance Taylor <ian at airs dot com>
- To: Kazu Hirata <kazu at codesourcery dot com>
- Cc: binutils at sources dot redhat dot com
- Date: 24 Jun 2005 07:54:41 -0400
- Subject: Re: Why does arm-*-as issue a warning for "strb r3, [r3], #1"?
- References: <200506240502.j5O529P4023042@sethra.codesourcery.com>
Kazu Hirata <kazu@codesourcery.com> writes:
> When I feed "strb r3, [r3], #1" to arm-*-as, the assembler issues a
> warning
>
> "source register same as write-back base"
>
> While I like helpful warnings in general, I am wondering if the
> assembler should issue a warning for something a little strange but
> otherwise correct because a compiler, a major user of the assembler,
> tries to get most out of the instruction set (modulo "discouraged"
> instructions). Note that gcc's testsuite treats a warning from the
> assembler as FAIL. (As far as I can tell from the instruction set
> manual, I don't see anything that bans "strb r3, [r3], #1".)
>
> I am tempted to submit a patch to remove this warning from tc-arm.c,
> but I am no expert on ARM.
According to my copy of the ARM ARM: "If <addressing mode> specifies
base register writeback, and the same register is specified for <Rd>
and <Rn>, the results are UNPREDICTABLE."
So I think the assembler is correct to warn about this construct, and
the compiler should not generate it.
Ian