Patchwork Go patch committed: Don't call __builtin_return_address (1)

login
register
mail settings
Submitter Ian Taylor
Date Jan. 5, 2011, 12:08 a.m.
Message ID <mcr8vz0nrfg.fsf@google.com>
Download mbox | patch
Permalink /patch/77551/
State New
Headers show

Comments

Ian Taylor - Jan. 5, 2011, 12:08 a.m.
The function runtime.Caller is not properly implemented in gccgo.  In
the dummy implementation, I accidentally called __builtin_return_address
with an argument of 1 rather than 0.  That fails to compile on two
targets.  This patch fixes that problem.  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  This should fix PR's 46958 and
46965.  Committed to mainline.

Ian

Patch

diff -r 5f4f01af0140 libgo/runtime/go-caller.c
--- a/libgo/runtime/go-caller.c	Tue Jan 04 15:29:15 2011 -0800
+++ b/libgo/runtime/go-caller.c	Tue Jan 04 16:02:55 2011 -0800
@@ -31,7 +31,7 @@ 
 
   /* A proper implementation needs to dig through the debugging
      information.  */
-  ret.pc = (uint64_t) (uintptr_t) __builtin_return_address (1);
+  ret.pc = (uint64_t) (uintptr_t) __builtin_return_address (0);
   ret.file.__data = NULL;
   ret.file.__length = 0;
   ret.line = 0;