http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36770
Steven Bosscher <steven at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |steven at gcc dot gnu.org --- Comment #6 from Steven Bosscher <steven at gcc dot gnu.org> --- (In reply to Gunnar von Boehn from comment #2) > Correct would be: > test2: > lwz 0,0(3) > stwu 0,4(3) > blr > > Is you can see the created bad code is just the same. > This is independent of the register pinning. At least with gcc 4.7.1 and gcc 4.9.0 (r206195) the register pinning makes all the difference. $ cat t.c register int * src asm("r15"); int test1( ){ src[1]=src[0]; src++; } int *test2(int *a ){ a[1]=a[0]; a++; return a; } $ ./cc1 -quiet -O2 t.c $ cat t.s ... .L.test1: lwz 10,0(15) mr 9,15 addi 15,15,4 stw 10,4(9) blr ... .L.test2: lwz 9,0(3) stwu 9,4(3) blr This is basically the same as bug 44281.