Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!AI.MIT.EDU!rms From: rms@AI.MIT.EDU Newsgroups: gnu.utils.bug Subject: [mcgrath%tully.Berkeley.EDU@ginger.berkeley.edu: gas 1.33 (68k) produces bad code] Message-ID: <8905231648.AA00238@sugar-bombs.ai.mit.edu> Date: 23 May 89 16:48:34 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 75 Return-Path: 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 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 : linkw fp,#0 0x20ac : movel @#0x20004 ,d0 0x20b2 : moveal 0x20c4 ,a0 0x20b6 : movel 0(a0)[d0.l*4],-(sp) 0x20ba : jsr @#0x20a0 0x20c0 : unlk fp 0x20c2 : rts The code produced by GAS: 0x20a8 : linkw fp,#0 0x20ac : movel @#0x20034 ,d0 0x20b2 : moveal @#0x20c2 ,a0 0x20b8 : movel 0(a0)[d0.l*4],-(sp) 0x20bc : bsr 0x20a0 0x20be : unlk fp 0x20c0 : rts (For some reason the addresses of `idx' and `list' are different, but ignore that.) The bad code is at 0x20b2 . Sun assembles: movel _list,a0 (which is what the source is). GAS assembles: movel @_list, a0