From mboxrd@z Thu Jan 1 00:00:00 1970 From: hjl@lucon.org (H.J. Lu) To: scox@cygnus.com Cc: egcs@cygnus.com Subject: A bug in reg-stack.c Date: Mon, 16 Mar 1998 20:25:00 -0000 Message-id: X-SW-Source: 1998-03/msg00552.html 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); }