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

            Bug ID: 60822
           Summary: Index register overwritten on m68k/coldfire
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pint at tlink dot de

I have a newlib based gcc-4.8.2 crosscompiler on a mingw host with this
configuration:

../gcc/configure --target=m68k-elf --prefix=/opt/gcc-4.8.2-m68k
--enable-threads --with-newlib --enable-static --with-gnu-as --with-gnu-ld
--enable-languages=c++
--with-headers=/src/gcc-4.8.2/build-gcc/../newlib/newlib/libc/include
--with-arch=cf

invoked with:

m68k-elf-gcc -mcpu=54455 -g0  -O2 -Wall -Wextra   -S test.cpp -otest.s

This test program:


struct X {
    char fill0[800000];
    int a;
    char fill1[900000];
    int b;

    int Avg(int s) const {return (s * (long long)(a + b)) >> 17;}
};

int f=1;
int o;
extern X x;

int main()
{
    o = x.Avg(f);
    return 0;
}


Produces this output:

    lea x,%a0
    move.l #1700004,%d0
    move.l #800000,%d1
    move.l %d3,-(%sp)
    .cfi_offset 3, -12
    moveq #15,%d3
    move.l (%a0,%d0.l),%d1
    add.l (%a0,%d1.l),%d1

Where the value #800000 is overwritten before used in the last statement.

Reply via email to