[gnu.utils.bug] [mcgrath%tully.Berkeley.EDU@ginger.berkeley.edu: gas 1.33

rms@AI.MIT.EDU (05/23/89)

Return-Path: <mcgrath%tully.Berkeley.EDU@ginger.berkeley.edu>
To: bug-gcc@prep.ai.mit.edu
Subject: gas 1.33 (68k) produces bad code
Date: Mon, 22 May 89 21:51:23 PDT
From: Roland McGrath <mcgrath%tully.Berkeley.EDU@ginger.berkeley.edu>

GAS 1.33, compiled out of the box for 68k (unpack distribution; make a68) on
a Sun 3 (68020), Sun Unix 3.5.

With the input:

#NO_APP
gcc_compiled.:
.text
	.even
.globl _func
_func:
	link a6,#0
	unlk a6
	rts
	.even
.globl _foo
_foo:
	link a6,#0
	movel _idx,d0
	movel _list,a0
	movel a0@(d0:l:4),sp@-
	jbsr _func
	unlk a6
	rts
.globl _idx
.data
	.even
_idx:
	.long 0
.globl _list
.text
	.even
_list:
	.long 0
	.even
.globl _main
_main:
	link a6,#0
	jbsr _foo
	unlk a6
	rts

The code produced by Sun as for the `foo' function (disassembly by GDB 3.1.1):

0x20a8 <foo>:	linkw fp,#0
0x20ac <foo+4>:	movel @#0x20004 <idx>,d0
0x20b2 <foo+10>:	moveal 0x20c4 <list>,a0
0x20b6 <foo+14>:	movel 0(a0)[d0.l*4],-(sp)
0x20ba <foo+18>:	jsr @#0x20a0 <func>
0x20c0 <foo+24>:	unlk fp
0x20c2 <foo+26>:	rts

The code produced by GAS:

0x20a8 <foo>:	linkw fp,#0
0x20ac <foo+4>:	movel @#0x20034 <idx>,d0
0x20b2 <foo+10>:	moveal @#0x20c2 <list>,a0
0x20b8 <foo+16>:	movel 0(a0)[d0.l*4],-(sp)
0x20bc <foo+20>:	bsr 0x20a0 <func>
0x20be <foo+22>:	unlk fp
0x20c0 <foo+24>:	rts

(For some reason the addresses of `idx' and `list' are different,
but ignore that.)

The bad code is at 0x20b2 <foo+10>.  Sun assembles:
	movel _list,a0
(which is what the source is).  GAS assembles:
	movel @_list, a0