PR 65798 says that in some cases runtime.Caller can return with ok ==
true when PC == 0.  It's not clear to me quite how that can happen,
but it's easy to avoid with this patch.  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline and GCC
5 branch.

Ian
diff -r 400258017261 libgo/runtime/go-caller.c
--- a/libgo/runtime/go-caller.c Fri Apr 17 14:27:33 2015 -0700
+++ b/libgo/runtime/go-caller.c Fri Apr 17 14:55:44 2015 -0700
@@ -166,7 +166,7 @@
 
   runtime_memclr (&ret, sizeof ret);
   n = runtime_callers (skip + 1, &loc, 1, false);
-  if (n < 1)
+  if (n < 1 || loc.pc == 0)
     return ret;
   ret.pc = loc.pc;
   ret.file = loc.filename;

Reply via email to