This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFA: fix valgrind failures 2/3
- From: Joern RENNECKE <joern dot rennecke at st dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 25 Jan 2005 19:41:52 +0000
- Subject: RFA: fix valgrind failures 2/3
The second problem was triggered when cse constant-folded a
cast of a integer pseudo to a float, where the constant value of
the register was known to cse.
Zeroing out the entire struct at the start of conversion not only
fixed the bug, it also made two later memset calls that zeroed out
remaining bits in the significand superflous.
2005-01-21 J"orn Rennecke <joern.rennecke@st.com>
* real.c (real_from_integer): Zero out destination.
Index: real.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/real.c,v
retrieving revision 1.150
diff -p -r1.150 real.c
*** real.c 21 Jan 2005 17:54:23 -0000 1.150
--- real.c 25 Jan 2005 18:45:17 -0000
*************** real_from_integer (REAL_VALUE_TYPE *r, e
*** 1957,1962 ****
--- 1960,1966 ----
get_zero (r, 0);
else
{
+ memset (r, 0, sizeof (*r));
r->cl = rvc_normal;
r->sign = high < 0 && !unsigned_p;
SET_REAL_EXP (r, 2 * HOST_BITS_PER_WIDE_INT);
*************** real_from_integer (REAL_VALUE_TYPE *r, e
*** 1974,1980 ****
{
r->sig[SIGSZ-1] = high;
r->sig[SIGSZ-2] = low;
- memset (r->sig, 0, sizeof(long)*(SIGSZ-2));
}
else
{
--- 1978,1983 ----
*************** real_from_integer (REAL_VALUE_TYPE *r, e
*** 1983,1990 ****
r->sig[SIGSZ-2] = high;
r->sig[SIGSZ-3] = low >> (HOST_BITS_PER_LONG - 1) >> 1;
r->sig[SIGSZ-4] = low;
- if (SIGSZ > 4)
- memset (r->sig, 0, sizeof(long)*(SIGSZ-4));
}
normalize (r);
--- 1986,1991 ----