Patchwork Go patch committed: Fix uninitialized variable looking up '_'

login
register
mail settings
Submitter Ian Taylor
Date Dec. 22, 2010, 1:37 a.m.
Message ID <mcry67iio4i.fsf@google.com>
Download mbox | patch
Permalink /patch/76354/
State New
Headers show

Comments

Ian Taylor - Dec. 22, 2010, 1:37 a.m.
This patch to the Go frontend fixes an uninitialized variable when
looking up the special name '_'.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

Patch

diff -r 931747c66dfc go/gogo.cc
--- a/go/gogo.cc	Tue Dec 21 17:27:30 2010 -0800
+++ b/go/gogo.cc	Tue Dec 21 17:34:02 2010 -0800
@@ -415,6 +415,9 @@ 
 Named_object*
 Gogo::lookup(const std::string& name, Named_object** pfunction) const
 {
+  if (pfunction != NULL)
+    *pfunction = NULL;
+
   if (Gogo::is_sink_name(name))
     return Named_object::make_sink();
 
@@ -431,9 +434,6 @@ 
 	}
     }
 
-  if (pfunction != NULL)
-    *pfunction = NULL;
-
   if (this->package_ != NULL)
     {
       Named_object* ret = this->package_->bindings()->lookup(name);