Go patch committed: Fix field tracking in global var initializer

Submitted by Ian Taylor on Dec. 3, 2012, 7:21 a.m.

Details

Message ID mcrtxs3sis0.fsf@google.com
State New
Headers show

Commit Message

Ian Taylor Dec. 3, 2012, 7:21 a.m.
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

Patch hide | download patch | download mbox

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;