This patch to the Go compiler avoids a crash if a tracked field is
referenced in the initializer for a global variable.  Bootstrapped on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 879fac2f2103 go/expressions.cc
--- a/go/expressions.cc	Sun Dec 02 22:55:02 2012 -0800
+++ b/go/expressions.cc	Sun Dec 02 23:19:27 2012 -0800
@@ -10651,7 +10651,8 @@
   // them if they are not referenced.  The effect is that the only
   // strings, indicating field references, that will wind up in the
   // executable will be those for functions that are actually needed.
-  function->func_value()->set_in_unique_section();
+  if (function != NULL)
+    function->func_value()->set_in_unique_section();
   var->set_in_unique_section();
 
   return this;

Reply via email to