public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bruno Haible <haible@ilog.fr>
To: egcs@cygnus.com
Subject: Re: egcs 1.0.2
Date: Mon, 16 Feb 1998 18:19:00 -0000	[thread overview]
Message-ID: <199802162213.XAA17132@halles.ilog.fr> (raw)
In-Reply-To: <m0y4VMR-00058gC@ocean.lucon.org>

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




  reply	other threads:[~1998-02-16 18:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-14 23:44 egcs cvs'd between 980214 8:00 and 9:13 UTC on m68k-next-nextstep3:Success Toon Moene
1998-02-15  8:24 ` egcs cvs'd between 980214 8:00 and 9:13 UTC on m68k-next-nextstep3: Success Jeffrey A Law
1998-02-15  8:32   ` egcs 1.0.2 H.J. Lu
1998-02-15  8:33     ` Jeffrey A Law
1998-02-15  8:42       ` H.J. Lu
1998-02-15  8:46         ` Jeffrey A Law
1998-02-15  8:50           ` H.J. Lu
1998-02-15 12:18     ` Joe Buck
1998-02-15 14:04       ` H.J. Lu
1998-02-16  4:49         ` Bernd Schmidt
1998-02-16 10:34           ` H.J. Lu
1998-02-16 18:19             ` Bruno Haible [this message]
1998-02-16 13:34 Daniel Egger
1998-02-16 14:21 ` H.J. Lu
1998-03-19 20:46 Felix Morley Finch
1998-03-30 16:18 Oyvind Yrke
1998-04-01 13:41 ` Jeffrey A Law
1998-04-01 19:44 ` Jim Wilson
1998-04-03 21:52   ` Joe Buck
1998-04-03 21:52 ` Andreas Schwab
     [not found] <3525297C.4A20D761@stavanger.geoquest.slb.com>
1998-04-03 21:52 ` Jim Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199802162213.XAA17132@halles.ilog.fr \
    --to=haible@ilog.fr \
    --cc=egcs@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).