From: J"orn Rennecke Date: Thu, 27 Jan 2005 12:57:41 +0000 (+0000) Subject: re PR c++/18370 (cp_parser_initializer_list uninit variable problems) X-Git-Tag: releases/gcc-3.4.4~266 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a7d8f63729b776f4eec22770f9cc1ad92a424ec;p=thirdparty%2Fgcc.git re PR c++/18370 (cp_parser_initializer_list uninit variable problems) gcc: * real.c (do_add): Initialize signalling and canonical members. * real.c (real_from_integer): Zero out destination. gcc/cp: PR c++/18370 * parser.c (cp_parser_initializer_clause): Initialize *non_constant_p. From-SVN: r94322 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b489880b9025..3ca24a7ab358 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-01-27 J"orn Rennecke + + * real.c (do_add): Initialize signalling and canonical members. + + * real.c (real_from_integer): Zero out destination. + 2005-01-26 Ulrich Weigand Backport from mainline: diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0103228ee003..869878c9d154 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2005-01-27 J"orn Rennecke + + PR c++/18370 + * parser.c (cp_parser_initializer_clause): Initialize *non_constant_p. + 2005-01-19 Kriang Lerdsuwanakij PR c++/19375 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 1bde1f9830b7..46d6bbf157f4 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -11543,6 +11543,9 @@ cp_parser_initializer_clause (cp_parser* parser, bool* non_constant_p) { tree initializer = NULL_TREE; + /* Assume the expression is constant. */ + *non_constant_p = false; + /* If it is not a `{', then we are looking at an assignment-expression. */ if (cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE)) diff --git a/gcc/real.c b/gcc/real.c index 11927ee59cf8..843725e55909 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -640,6 +640,9 @@ do_add (REAL_VALUE_TYPE *r, const REAL_VALUE_TYPE *a, r->class = rvc_normal; r->sign = sign; r->exp = exp; + /* Zero out the remaining fields. */ + r->signalling = 0; + r->canonical = 0; /* Re-normalize the result. */ normalize (r); @@ -1960,6 +1963,7 @@ real_from_integer (REAL_VALUE_TYPE *r, enum machine_mode mode, get_zero (r, 0); else { + memset (r, 0, sizeof (*r)); r->class = rvc_normal; r->sign = high < 0 && !unsigned_p; r->exp = 2 * HOST_BITS_PER_WIDE_INT; @@ -1977,7 +1981,6 @@ real_from_integer (REAL_VALUE_TYPE *r, enum machine_mode mode, { r->sig[SIGSZ-1] = high; r->sig[SIGSZ-2] = low; - memset (r->sig, 0, sizeof(long)*(SIGSZ-2)); } else if (HOST_BITS_PER_LONG*2 == HOST_BITS_PER_WIDE_INT) { @@ -1985,8 +1988,6 @@ real_from_integer (REAL_VALUE_TYPE *r, enum machine_mode mode, 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)); } else abort ();