http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53033

             Bug #: 53033
           Summary: [avr]: Wrong register number for 3-byte loads via X
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: g...@gcc.gnu.org
            Target: avr


void foo (__int24 *p)
{
    void bar (__int24);
    asm ("" : "+x" (p));
    bar (*++p);
}

Compile with

$ avr-gcc foo.c -S -Os

and the generated code is

foo:
    mov r26,r24
    mov r27,r25
    adiw r26,3
    ld r24,X+
    ld r25,X+
    ld r26,X
    sbiw r26,3+2
    rjmp bar

The destination register of the PSI move is always R24.

Reply via email to