This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Why does arm-*-as issue a warning for "strb r3, [r3], #1"?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]