[gnu.gcc.bug] gcc 1.31 generates bad 68020 code when -fforce-addr is used

moraes@csri.toronto.edu (Mark Moraes) (11/30/88)

The following file and session illustrate the error - 'as' complains about
illegal operands of the form 'lea sp@-,a0'. These were not present in
gcc 1.30.

Gcc compiled and run on a Sun3/180 running SunOS3.5 - used 'config.gcc
sun3'.

% cat foo.c
typedef unsigned long Mask;

typedef struct _DetailRec {             /* Grab details may be bit masks */
        unsigned short exact;
        Mask *pMask;
} DetailRec;

#define TRUE 1
#define FALSE 0

static int
DetailSupersedesSecond(firstDetail, secondDetail, exception)
DetailRec firstDetail, secondDetail;
unsigned short exception;
{
    if (IsInGrabMask(firstDetail, secondDetail, exception))
        return TRUE;

    if (IdenticalExactDetails(firstDetail.exact, secondDetail.exact, exception))
        return TRUE;
  
    return FALSE;

}

% gcc -v -O -S foo.c
gcc version 1.31
 /local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__OPTIMIZE__ -D__HAVE_68881__ -Dmc68020 foo.c /tmp/cca12767.cpp
GNU CPP version 1.31
 /local/lib/gcc-cc1 /tmp/cca12767.cpp -quiet -dumpbase foo.c -O -version -o foo.s
GNU C version 1.31 (68k, MIT syntax) compiled by GNU C version 1.31.
% gcc -c -v foo.s
gcc version 1.31
 as -mc68020 foo.s -o foo.o
% mv foo.s foo.s.ok
% gcc -v -O -fforce-addr -S foo.c
gcc version 1.31
 /local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__OPTIMIZE__ -D__HAVE_68881__ -Dmc68020 foo.c /tmp/cca12776.cpp
GNU CPP version 1.31
 /local/lib/gcc-cc1 /tmp/cca12776.cpp -quiet -dumpbase foo.c -fforce-addr -O -version -o foo.s
GNU C version 1.31 (68k, MIT syntax) compiled by GNU C version 1.31.
% gcc -c -v foo.s
gcc version 1.31
 as -mc68020 foo.s -o foo.o
as: error (foo.s:12): Invalid operand
as: error (foo.s:14): Invalid operand
as: error (foo.s:17): Invalid operand
as: error (foo.s:19): Invalid operand
% diff foo.s.ok foo.s
12,13c12,15
<       movel a6@(18),sp@-
<       movew a6@(16),sp@-
---
>       lea sp@-,a0
>       movel a6@(18),a0@
>       lea sp@-,a0
>       movew a6@(16),a0@
15,16c17,20
<       movel a6@(10),sp@-
<       movew a6@(8),sp@-
---
>       lea sp@-,a0
>       movel a6@(10),a0@
>       lea sp@-,a0
>       movew a6@(8),a0@
%