Test gcc.c-torture/compile/930210-1.c, when compiled with: -O2 -c
produces the warning: /var/tmp//ccSVOi5X.s: Assembler messages: /var/tmp//ccSVOi5X.s:23: Warning: source register same as write-back base Because of the following instruction generated in the assembly: strb r2, [r2], #1 The assembler warning is produced because the instruction is unpredictable when the source register and the base destination register are the same and post-increment addressing is used. Note that while this test doesn't fail for the arm-none-elf target, a similar test case does demonstrate the same issue: void f(void) { char c1, c2; char *p1, *p2; c1 = c2 = *p1++; while (c1--) *p2++ = *p1++; } This behavior is present in gcc-4.1.0-20050405, and gcc-4.0.0-20050410 (RC1). Configuration options: --target=arm-unknown-elf --program-prefix=arm-elf- --disable-nls -- enable-languages=c,c++ --with-newlib --enable-multilib --disable-shared -- Summary: Compiler-generated code produces an assembler warning Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jconner at apple dot com CC: gcc-bugs at gcc dot gnu dot org GCC host triplet: powerpc-apple-darwin7.8.0 GCC target triplet: arm-unknown-elf http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20972