From mboxrd@z Thu Jan 1 00:00:00 1970 From: hjl@lucon.org (H.J. Lu) To: kilpatds@erols.com (Douglas Kilpatrick) Cc: egcs@cygnus.com, libc-linux@gnu.org (GNU C Library) Subject: An important patch for egcs 1.0.1 Date: Thu, 12 Feb 1998 20:07:00 -0000 Message-id: References: <34E2AFA6.F4E316C@erols.com> X-SW-Source: 1998-02/msg00564.html > > H.J. Lu wrote: > > > > This test failed on both egcs 1.0.1 and egcs 1.0.2 under Linux/x86. > > Sorry to do this to you... but I was wondering if you could explain the > test case... I've been digging into long double's trying to find the > root cause of a problem in kcalc, so it looks like this test case could > Below I have a program that dies under egcs1.0.1+glibc. There may be a ^^^^^^^^^^^^^^^^ That is a bad combination. > glibc bug in here, but I think it may also show an egcs bug. Is this a > related problem? > > Doug > -- kilpatds@erols.com > > #include > #include > #include > #include > > int main(int argc, char *argv[]) > { > long double ld; > long l; > > modfl(1.0, &ld); > l = ld; > printf("Long Double: %lf\nLong: %ld\nLong: %X\n", ld, l); > if (l > 1) > abort(); > if (l < 0) > abort(); > > return EXIT_SUCCESS; > } Please include this in egcs 1.0.2. It may fix your bug. At least, mine is fixed. BTW, given this bad bug, which is fixed in gcc 2.8.0, we should make egcs 1.0.2 ASAP. Otherwise, it will be hard for us to convince the people to use egcs. Thanks. ---- Fri Dec 5 16:26:03 1997 Bernd Schmidt * i386.c (notice_update_cc): Remove bogus pentium GCC code. --- ./../../../import/egcs/gcc/config/i386/i386.c Fri Dec 19 00:47:13 1997 +++ config/i386/i386.c Thu Feb 12 10:49:09 1998 @@ -3397,31 +3397,37 @@ 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; } + /* Moving register into memory doesn't alter the cc's. It may invalidate the RTX's which we remember the cc's came from. */ if (GET_CODE (SET_DEST (exp)) == MEM && (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)) + if (cc_status.value1 + && reg_overlap_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)) + if (cc_status.value2 + && reg_overlap_mentioned_p (SET_DEST (exp), cc_status.value2)) cc_status.value2 = 0; + return; } + /* Function calls clobber the cc's. */ else if (GET_CODE (SET_SRC (exp)) == CALL) { CC_STATUS_INIT; return; } + /* Tests and compares set the cc's in predictable ways. */ else if (SET_DEST (exp) == cc0_rtx) { @@ -3429,14 +3435,14 @@ cc_status.value1 = SET_SRC (exp); return; } + /* Certain instructions effect the condition codes. */ else if (GET_MODE (SET_SRC (exp)) == SImode || GET_MODE (SET_SRC (exp)) == HImode || GET_MODE (SET_SRC (exp)) == QImode) switch (GET_CODE (SET_SRC (exp))) { - case ASHIFTRT: case LSHIFTRT: - case ASHIFT: + case ASHIFTRT: case LSHIFTRT: case ASHIFT: /* Shifts on the 386 don't set the condition codes if the shift count is zero. */ if (GET_CODE (XEXP (SET_SRC (exp), 1)) != CONST_INT) @@ -3444,6 +3450,7 @@ CC_STATUS_INIT; break; } + /* We assume that the CONST_INT is non-zero (this rtx would have been deleted if it were zero. */ @@ -3468,6 +3475,7 @@ if (SET_DEST (XVECEXP (exp, 0, 0)) == pc_rtx) return; if (SET_DEST (XVECEXP (exp, 0, 0)) == cc0_rtx) + { CC_STATUS_INIT; if (stack_regs_mentioned_p (SET_SRC (XVECEXP (exp, 0, 0)))) @@ -3481,6 +3489,7 @@ cc_status.value1 = SET_SRC (XVECEXP (exp, 0, 0)); return; } + CC_STATUS_INIT; } else