diff mbox

RFA: Avoid unnecessary clearing in union initialisers

Message ID g4wrflxesf.fsf@googlemail.com
State New
Headers show

Commit Message

Richard Sandiford July 14, 2011, 11:49 a.m. UTC
"H.J. Lu" <hjl.tools@gmail.com> writes:
> This caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49736

Sorry for the breakage.  It was due to a humiliating stupid mistake
in the hunk to update all_zeros_p:

@@ -5129,13 +5152,12 @@ mostly_zeros_p (const_tree exp)
 all_zeros_p (const_tree exp)
 {
   if (TREE_CODE (exp) == CONSTRUCTOR)
-
     {
-      HOST_WIDE_INT nz_elts, count;
-      bool must_clear;
+      HOST_WIDE_INT nz_elts, init_elts;
+      bool complete_p;
 
-      categorize_ctor_elements (exp, &nz_elts, &count, &must_clear);
-      return nz_elts == 0;
+      categorize_ctor_elements (exp, &nz_elts, &init_elts, &complete_p);
+      return nz_elts == init_elts;
     }
 
   return initializer_zerop (exp);

which was due to trying a different approach and not properly reverting it.

I've applied the following as obvious.  Tested on x86_64-linux-gnu,
and on 255.vortex.

Richard


gcc/
	PR middle-end/49736
	* expr.c (all_zeros_p): Undo bogus part of last change.
diff mbox

Patch

Index: gcc/expr.c
===================================================================
--- gcc/expr.c	2011-07-14 11:46:42.000000000 +0100
+++ gcc/expr.c	2011-07-14 11:47:40.000000000 +0100
@@ -5157,7 +5157,7 @@  all_zeros_p (const_tree exp)
       bool complete_p;
 
       categorize_ctor_elements (exp, &nz_elts, &init_elts, &complete_p);
-      return nz_elts == init_elts;
+      return nz_elts == 0;
     }
 
   return initializer_zerop (exp);