Compiling the testcase for BUG #27386 with the fr30-elf crosscompiler
shows that while reloading memory operands to registers the source adress of
the memory operand is changed.

testcase:

typedef unsigned long long uint64_t;

uint64_t a, b, c;

int
foo(uint64_t x, uint64_t y, uint64_t z, int i)
{
        a = x;
        b = y;
        c = z;
        return 2 * i;
}

int main( void )
{
        return foo(1234512345123ull,
                   3456734567345ull,
                   7897897897897ull,
                   42);


}

Looking at the assembler output which should store argument x in a

        ldi:32  a, r3   
        ldi:8   #248, r1
        extsb   r1      
        addn    fp, r1  
        ld      @r1, r1 
        mov     r1, r2    <-- *
        addn    4, r2   
        ld      @r2, r2 
        st      r1, @r3 
        st      r1, @-r15       
        mov     r3, r1  
        addn    4, r1   
        st      r2, @r1 

At the position marked with * the compiler probably wants the adress of a which
was stored in r1 but r1 was changed by the previous ld instruction.


-- 
           Summary: gcc produces erroneous asm for movdi
           Product: gcc
           Version: 4.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: markus dot heigl at fme dot fujitsu dot com
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: fr30-unknown-elf


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

Reply via email to