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]

Go patch committed: Always initialize nested_off


In PR 56198 Jakub points out that Import_archive::interpret_header did
not always initialized nested_off.  This could never be an actual
problem, as nested_off was always set when an archive member might be
used.  But it caused a compilation warning.  Fixed with this patch.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

diff -r 2c7569fc43a1 go/import-archive.cc
--- a/go/import-archive.cc	Sat Feb 02 07:38:09 2013 -0800
+++ b/go/import-archive.cc	Mon Feb 04 17:06:37 2013 -0800
@@ -277,6 +277,7 @@
       return false;
     }
 
+  *nested_off = 0;
   if (hdr->ar_name[0] != '/')
     {
       const char* name_end = strchr(hdr->ar_name, '/');
@@ -288,7 +289,6 @@
 	  return false;
 	}
       pname->assign(hdr->ar_name, name_end - hdr->ar_name);
-      *nested_off = 0;
     }
   else if (hdr->ar_name[1] == ' ')
     {
@@ -327,8 +327,7 @@
 	  return false;
 	}
       pname->assign(name, name_end - 1 - name);
-      if (nested_off != NULL)
-        *nested_off = y;
+      *nested_off = y;
     }
 
   return true;

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