diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4b87a8c6e4033f4a2586a70ce5620c2069118c5b..20caa7a7724b9088fa7feb91035b83430f7cbe3f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-05-21 Richard Henderson <rth@redhat.com> + + * emit-rtl.c (init_emit_once): Zero unused memory in a + CONST_DOUBLE. + 2001-05-21 Mark Mitchell <mark@codesourcery.com> * tree.h (type_num_arguments): Declare it. diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index e1e26df102272a4c2670224ead1318cb5555b2a3..7a98f20f46b81a485bf053de752b66cace6ae6fd 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -4336,9 +4336,16 @@ init_emit_once (line_numbers) rtx tem = rtx_alloc (CONST_DOUBLE); union real_extract u; - memset ((char *) &u, 0, sizeof u); /* Zero any holes in a structure. */ + /* Zero any holes in a structure. */ + memset ((char *) &u, 0, sizeof u); u.d = i == 0 ? dconst0 : i == 1 ? dconst1 : dconst2; + /* Avoid trailing garbage in the rtx. */ + if (sizeof (u) < sizeof (HOST_WIDE_INT)) + CONST_DOUBLE_LOW (tem) = 0; + if (sizeof (u) < 2 * sizeof (HOST_WIDE_INT)) + CONST_DOUBLE_HIGH (tem) = 0; + memcpy (&CONST_DOUBLE_LOW (tem), &u, sizeof u); CONST_DOUBLE_MEM (tem) = cc0_rtx; CONST_DOUBLE_CHAIN (tem) = NULL_RTX;