Patchwork [trivial] : Avoid various "may be used uninitialized" warnings

login
register
mail settings
Submitter Uros Bizjak
Date July 4, 2012, 12:48 p.m.
Message ID <CAFULd4awTpPuKG1dAROMERRr27tpqWguQsOcz3f6J4sz8TZ-JA@mail.gmail.com>
Download mbox | patch
Permalink /patch/168979/
State New
Headers show

Comments

Uros Bizjak - July 4, 2012, 12:48 p.m.
Hello!

Several otherwise harmless "may be used uninitialized" warnings break
LTO profiled bootstrap.  Attached patch fixes all these places,
enabling profiled LTO bootstrap to continue.

2012-07-04  Uros Bizjak  <ubizjak@gmail.com>

	* expmed.c (expand_mult): Initialize coeff and is_neg.

java/ChangeLog:

2012-07-04  Uros Bizjak  <ubizjak@gmail.com>

	* jcf-io.c (read_zip_member): Zero d_stream.

fortran/ChangLog:

2012-07-04  Uros Bizjak  <ubizjak@gmail.com>

	* parse.c (gfc_parse_file): Initialize errors_before.

Bootstrapped and regression tested on x86_64-pc-linux-gnu with LTO
profiledbootstrap, with additional PR 53321 and PR 53433 patches.

If there are no objections, I plan to commit the patch to mainline SVN tomorrow.

Uros.

Patch

Index: gcc/java/jcf-io.c
===================================================================
--- gcc/java/jcf-io.c	(revision 189217)
+++ gcc/java/jcf-io.c	(working copy)
@@ -202,9 +202,7 @@  read_zip_member (JCF *jcf,  ZipDirectory *zipd, Zi
     {
       char *buffer;
       z_stream d_stream; /* decompression stream */
-      d_stream.zalloc = (alloc_func) 0;
-      d_stream.zfree = (free_func) 0;
-      d_stream.opaque = (voidpf) 0;
+      memset (&d_stream, 0, sizeof (d_stream));
 
       jcf->buffer = XNEWVEC (unsigned char, zipd->uncompressed_size);
       d_stream.next_out = jcf->buffer;
Index: gcc/fortran/parse.c
===================================================================
--- gcc/fortran/parse.c	(revision 189217)
+++ gcc/fortran/parse.c	(working copy)
@@ -4512,6 +4512,7 @@  gfc_parse_file (void)
   gfc_global_ns_list = next = NULL;
 
   seen_program = 0;
+  errors_before = 0;
 
   /* Exit early for empty files.  */
   if (gfc_at_eof ())
Index: gcc/expmed.c
===================================================================
--- gcc/expmed.c	(revision 189217)
+++ gcc/expmed.c	(working copy)
@@ -3138,8 +3138,8 @@  expand_mult (enum machine_mode mode, rtx op0, rtx
   if (INTEGRAL_MODE_P (mode))
     {
       rtx fake_reg;
-      HOST_WIDE_INT coeff;
-      bool is_neg;
+      HOST_WIDE_INT coeff = 0;
+      bool is_neg = false;
       int mode_bitsize;
 
       if (op1 == CONST0_RTX (mode))