This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
m68k PIC bug in gcc 2.95.2
- To: gcc-bugs at gcc dot gnu dot org
- Subject: m68k PIC bug in gcc 2.95.2
- From: Kars de Jong <jongk at cs dot utwente dot nl>
- Date: Mon, 22 Nov 1999 03:08:29 +0100
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 |-----**[======---------