This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH to real.c:do_multiply


I tracked down a recent bootstrap failure to our failure to initialize
u.canonical along with the rest of u.

Repeat after me:  I will always use memset to initialize a struct.  Trying
to initialize all members invariably breaks.

Booted and tested powerpc-linux-gnu, applied to trunk and tree-ssa.

2003-08-27  Jason Merrill  <jason@redhat.com>

	* real.c (do_multiply): Initialize with memset.

*** real.c.~1~	2003-07-23 12:59:52.000000000 -0400
--- real.c	2003-08-27 16:36:14.000000000 -0400
*************** do_multiply (REAL_VALUE_TYPE *r, const R
*** 763,770 ****
  	      continue;
  	    }
  
  	  u.class = rvc_normal;
- 	  u.sign = 0;
  	  u.exp = exp;
  
  	  for (k = j; k < SIGSZ * 2; k += 2)
--- 763,770 ----
  	      continue;
  	    }
  
+ 	  memset (&u, 0, sizeof (u));
  	  u.class = rvc_normal;
  	  u.exp = exp;
  
  	  for (k = j; k < SIGSZ * 2; k += 2)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]