This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: egcs 1.0.2
- To: egcs at cygnus dot com
- Subject: Re: egcs 1.0.2
- From: Bruno Haible <haible at ilog dot fr>
- Date: Mon, 16 Feb 1998 23:13:35 +0100 (MET)
H.J.:
> It appears that the patch really came from
>
> Mon Sep 29 08:21:35 1997 Bruno Haible
>
> * i386.c (notice_update_cc): Use reg_overlap_mentioned_p.
>
> which is not in egcs 1.0.1.
I apologize for having sent that patch to Kenner only, not to this list.
Here it is again.
egcs-1.0.1 has a bug which wasn't present in gcc-2.7.2.
A "testl $64,%eax" or "testb $64,-4(%ebp)" is omitted. This kind of bug
occurs in particular when DImode variables are used. Please find below
a problem report and a fix.
========================= foo.c ======================
typedef struct { int addr; int type; } object;
extern object bar (object);
object foo (object x, object y)
{
object z = *(object*)(x.addr);
if (z.type & 64)
{
y = *(object*)(z.addr+8);
z = *(object*)(z.addr);
if (z.type & 64)
y = bar(y);
}
return y;
}
======================================================
$ ./xgcc -B./ -O -S foo.c && cat foo.s
.file "foo.c"
.version "01.01"
/ GNU C version egcs-2.90.23 980102 (egcs-1.0.1 release) (i586-pc-linux-gnulibc1) compiled by GNU C version 2.7.2.
/ options passed: -O
/ options enabled: -fdefer-pop -fthread-jumps -fpeephole -ffunction-cse
/ -finline -fkeep-static-consts -fpcc-struct-return -fcommon -fverbose-asm
/ -fgnu-linker -falias-check -fargument-alias -m80387 -mhard-float
/ -mno-soft-float -mieee-fp -mfp-ret-in-387 -mschedule-prologue
/ -mcpu=pentium -march=pentium
gcc2_compiled.:
.text
.align 4
.globl foo
.type foo,@function
foo:
pushl %ebp
movl %esp,%ebp
subl $8,%esp
pushl %esi
pushl %ebx
movl 8(%ebp),%ebx
movl 12(%ebp),%eax
movl (%eax),%edx
movl %edx,-8(%ebp)
movl 4(%eax),%eax
movl %eax,-4(%ebp)
testb $64,-4(%ebp)
je .L2
movl 8(%edx),%esi
movl %esi,20(%ebp)
movl 12(%edx),%ecx
movl %ecx,24(%ebp)
movl (%edx),%eax
movl %eax,-8(%ebp)
movl 4(%edx),%eax
movl %eax,-4(%ebp)
;; <========== "testl $64,%eax" missing here
je .L2
leal 20(%ebp),%eax
pushl %ecx
pushl %esi
pushl %eax
call bar
.L2:
movl 20(%ebp),%eax
movl %eax,(%ebx)
movl 24(%ebp),%eax
movl %eax,4(%ebx)
movl %ebx,%eax
leal -16(%ebp),%esp
popl %ebx
popl %esi
movl %ebp,%esp
popl %ebp
ret $4
.Lfe1:
.size foo,.Lfe1-foo
.ident "GCC: (GNU) egcs-2.90.23 980102 (egcs-1.0.1 release)"
===============================================================================
Here is the fix, which is already present in gcc-2.8.0. (Incidentally,
Kenner mutilated my changelog entry when putting in the patch.)
Sun Sep 28 03:45:32 1997 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
* i386/i386.c (notice_update_cc): Use reg_overlap_mentioned_p, not
reg_mentioned_p, for cc_status.value1 might be a ZERO_EXTRACT rtx.
===============================================================================
*** egcs-1.0.1/gcc/config/i386/i386.c.bak Fri Dec 19 09:47:13 1997
--- egcs-1.0.1/gcc/config/i386/i386.c Mon Feb 16 22:59:43 1998
***************
*** 3408,3418 ****
&& (REG_P (SET_SRC (exp))
|| GET_RTX_CLASS (GET_CODE (SET_SRC (exp))) == '<'))
{
! if (cc_status.value1 && GET_CODE (cc_status.value1) == MEM
! || reg_mentioned_p (SET_DEST (exp), cc_status.value1))
cc_status.value1 = 0;
! if (cc_status.value2 && GET_CODE (cc_status.value2) == MEM
! || reg_mentioned_p (SET_DEST (exp), cc_status.value2))
cc_status.value2 = 0;
return;
}
--- 3408,3418 ----
&& (REG_P (SET_SRC (exp))
|| GET_RTX_CLASS (GET_CODE (SET_SRC (exp))) == '<'))
{
! if (cc_status.value1
! && reg_overlap_mentioned_p (SET_DEST (exp), cc_status.value1))
cc_status.value1 = 0;
! if (cc_status.value2
! && reg_overlap_mentioned_p (SET_DEST (exp), cc_status.value2))
cc_status.value2 = 0;
return;
}
===============================================================================
Can you please put in this patch in the devel branch and later into
egcs-1.0.2 ?
Bruno