m68k PIC bug in gcc 2.95.2
Kars de Jong
jongk@cs.utwente.nl
Sun Nov 21 18:08:00 GMT 1999
Hi,
System: Linux/m68k kernel 2.2.10
Libc: glibc 2.1.2
Gcc: gcc 2.95.2
Cflags: -O -fPIC
The following program miscompiles with gcc 2.95.2. The problem was probably
introduced in egcs-19990629, when the PIC prologue/epilogue for m68k was
rewritten.
The program compiles correct with gcc 2.7.2.3.
------------------------------------------------------------------------------
int frog() {
if (2 <= 1) {
printf("test");
}
return -1;
}
------------------------------------------------------------------------------
bash# gcc -O -fPIC bing.c -S
Output bing.s:
------------------------------------------------------------------------------
frog:
link.w %a6,#0
lea (%pc, _GLOBAL_OFFSET_TABLE_@GOTPC), %a5
moveq.l #-1,%d0 | 22 movsi+1/2
unlk %a6
rts
------------------------------------------------------------------------------
The PIC register (a5) is used without being saved or restored. It looks like
the 'lea' should have been eliminated after optimisation, the save/restore
were eliminated (when compiling with -O0 a5 is saved/restored).
Kars.
--
------------------------------------------------------------------------------
Kars de Jong Signaalkamp rules the waves! Turrican@Discworld
--------======]**-----| jongk@cs.utwente.nl |-----**[======---------
More information about the Gcc-bugs
mailing list