Egcs 1.1 produces incorrect ColdFire code

Eric Devolder ra3677@email.sps.mot.com
Tue Sep 15 08:14:00 GMT 1998


Hey all, I've configured Egcs 1.1b with Binutils 2.9.1 for m68k-coff.
Here is a simple program that illustrates the incorrect code:

typedef struct
{
    char spacing[0xAAAA]; /* value which breaks 16-bit displacement */
    char tryme;
} silly;

void
main (void)
{
    silly *sill = 0;

    sill->tryme = 0xABCD;
}

When compiling with Egcs 1.1b, I obtain the following:

/usr2/styx/comp/m68k/egcs-1.1b/binutils-2.9.1/bin/m68k-coff-gcc -m5200
-S -I../../src/include -I../../src/dbug/v2 -I. -fno-builtin -ansi -Wall
-D MCF5206_EVS src/dbug/t.c -o obj/gnu/board/t.s
src/dbug/t.c:9: warning: return type of `main' is not `int'
src/dbug/t.c: In function `main':
src/dbug/t.c:12: warning: overflow in implicit constant conversion
/usr2/styx/comp/m68k/egcs-1.1b/binutils-2.9.1/bin/m68k-coff-as  -m5200
--register-prefix-optional -ahls=obj/gnu/board/t.lst -o
obj/gnu/board/t.o obj/gnu/board/t.s
obj/gnu/board/t.s: Assembler messages:
obj/gnu/board/t.s:13: Error: displacement too large for this
architecture; needs 68020 or higher -- statement `move.b %d0,43690(%a0)'
ignored

Here is the listing file:

68K GAS  obj/gnu/board/t.s          page 1


   1                    .file   "t.c"
   2                gcc2_compiled.:
   3                __gnu_compiled_c:
   4                .text
   5 ???? 00                .even
   6                .globl main
   7                main:
   8 ???? 4E56 FFFC         link.w %a6,#-4
   9 ???? 4EB9 0000         jsr __main
   9      0000
  10 ???? 42AE FFFC         clr.l -4(%a6)
  11 ???? 206E FFFC         move.l -4(%a6),%a0
  12 ???? 70CD              moveq.l #-51,%d0
  13                    move.b %d0,43690(%a0)        <---- invalid
16-bit displacement
  14                .L1:
  15 ???? 4E5E              unlk %a6
  16                    rts
^L68K GAS  obj/gnu/board/t.s            page 2

The assembler correctly catches the invalid displacement for ColdFire.

For what its worth, this was working in Egcs 1.0.3, as evidenced by the
listing file below:

68K GAS  obj/gnu/board/t.s          page 1


   1                    .file   "t.c"
   2                gcc2_compiled.:
   3                __gnu_compiled_c:
   4                .text
   5                    .even
   6                .globl main
   7                main:
   8 0000 4E56 FFFC         link.w %a6,#-4
   9 0004 4EB9 0000         jsr __main
   9      0000
  10 000a 42AE FFFC         clr.l -4(%a6)
  11 000e 206E FFFC         move.l -4(%a6),%a0
  12 0012 203C 0000         move.l #43690,%d0
  12      AAAA
  13 0018 72CD              moveq.l #-51,%d1
  14 001a 1181 0800         move.b %d1,(%a0,%d0.l)
  15                .L1:
  16 001e 4E5E              unlk %a6
  17 0020 4E75              rts
^L68K GAS  obj/gnu/board/t.s            page 2



Thanks,
Eric




More information about the Gcc-bugs mailing list