Article View: gnu.gcc.bug
Article #2006'-fforce-addr' generates illegal MC68000 instruction
From: lmayk!lgm
Date: Sat, 26 Nov 1988 21:46
Date: Sat, 26 Nov 1988 21:46
69 lines
2130 bytes
2130 bytes
SYNOPSIS:
The '-fforce-addr' option can generate illegal MC68000 instructions
for the passing of a structure by value as a function argument.
MACHINE AND OS:
AT&T UNIX PC 3B1 (based on Motorola 68010 microprocessor) running
OS Version 3.5 (compatible with UNIX System V Release 2).
CONFIGURATION FILES:
(usual for the UNIX PC)
"tm-3b1.h"
"xm-3b1.h"
"m68k.md"
"output-m68k.c"
TRANSCRIPT (INPUT FILE, COMMAND LINE, OUTPUT):
_______________________________________
$ cat struc.c
struct S {
short s[ 6 ];
};
extern void g();
void
f( s )
struct S s;
{
g( s );
}
$ gcc -v -S -O -fforce-addr struc.c
gcc version 1.31
/usr/local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dmc68k -Dunix -Dunixpc -D__OPTIMIZE__ struc.c /tmp/cca04406.cpp
GNU CPP version 1.31
/usr/local/lib/gcc-cc1 /tmp/cca04406.cpp -quiet -dumpbase struc.c -fforce-addr -O -version -o struc.s
GNU C version 1.31 (68k, SGS/AT&T unixpc syntax) compiled by GNU C version 1.31.
$ cat struc.s
file "struc.c"
text
even
global f
f:
link.w %a6,&0
lea 20(%fp),%a0
lea -(%sp),%a1 # Illegal addressing mode for 'lea'
mov.l -(%a0),(%a1)
lea -(%sp),%a1 # Similarly illegal
mov.l -(%a0),(%a1)
lea -(%sp),%a1 # Similarly illegal
mov.l -(%a0),(%a1)
jsr g
unlk %a6
rts
$
_______________________________________
EXPLANATION OF TRANSCRIPT:
'lea' does not accept the predecrement addressing mode. Ironically,
in this case the wiser course is not to generate the 'lea' instructions
at all, but rather to leave the original sequence (i.e., the one
that is generated without the '-fforce-addr' option), which uses
mov.l -(%a0),-(%sp)
Lawrence G. Mayka
Aurora, Illinois
chinet!lmayk!lgm
Technical Details
Message-ID:
<8811262134.aa11994@gamma.eecs.nwu.edu>Path:
arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!ODDJOB.UCHICAGO.EDU!lmayk!lgmShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!ODDJOB.UCHICAGO.EDU!lmayk!lgm From: lmayk!lgm@ODDJOB.UCHICAGO.EDU Newsgroups: gnu.gcc.bug Subject: '-fforce-addr' generates illegal MC68000 instruction Message-ID: <8811262134.aa11994@gamma.eecs.nwu.edu> Date: 26 Nov 88 21:46:59 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 69