public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* A bug in reg-stack.c
@ 1998-03-16 20:25 H.J. Lu
  1998-03-18 16:29 ` Jim Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 1998-03-16 20:25 UTC (permalink / raw)
  To: scox; +Cc: egcs

Hi,

reg-stack.c has quite a few bugs. Here is a test case.

# gcc cc -S -O2 980313-1.c
cc: Internal compiler error: program cc1 got fatal signal 6

The problem is in compare_for_stack_reg (). Around line 2063, there
are

  replace_reg (src1, FIRST_STACK_REG);
   
  if (STACK_REG_P (*src2))
    replace_reg (src2, get_hard_regnum (regstack, *src2));

  if (src1_note)
    {
      CLEAR_HARD_REG_BIT (regstack->reg_set, REGNO (XEXP (src1_note, 0)));
      replace_reg (&XEXP (src1_note, 0), FIRST_STACK_REG);
      regstack->top--;
    }

That is quite bogus since probably REGNO (XEXP (src1_note, 0)) !=
FIRST_STACK_REG. regstack->top-- is not correct to remove the dead
register. Could someone please take a look?

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
---980313-1.c-----
/* { dg-do compile { target i?86-*-* } } */
/* { dg-options "-O2 -mach=pentiumpro" } */

extern __inline  double
__expm1 (double __x)
{
  double __temp;
  __temp -= 1.0;
  return __temp;
}
extern __inline  double
__sgn1 (double __x)
{
  return __x >= 0.0 ? 1.0 : -1.0;
}
double
tanh (double __x)
{
  register double __exm1 = __expm1 (__x);
  return __exm1 / (__exm1 + 2.0) * __sgn1 (-__x);
}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: A bug in reg-stack.c
  1998-03-16 20:25 A bug in reg-stack.c H.J. Lu
@ 1998-03-18 16:29 ` Jim Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Jim Wilson @ 1998-03-18 16:29 UTC (permalink / raw)
  To: H.J. Lu; +Cc: scox, egcs

	reg-stack.c has quite a few bugs. Here is a test case.

Thanks.  I added this testcase for the reg-stack.c bug.

Jim

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-03-18 16:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-03-16 20:25 A bug in reg-stack.c H.J. Lu
1998-03-18 16:29 ` Jim Wilson

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).