[Bug go/65798] runtime.Caller returns ok=true when return data is invalid

ian at airs dot com gcc-bugzilla@gcc.gnu.org
Fri Apr 17 21:39:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65798

--- Comment #1 from Ian Lance Taylor <ian at airs dot com> ---
The libgo code actually follows the lead of the gc code here.  The 1.3 code, in
C, said this:

    } else if((f = runtime·findfunc(rpc[1])) == nil) {
        retfile = runtime·emptystring;
        retline = 0;
        retbool = true;  // have retpc at least

The 1.4 code, in Go, says this:

    f := findfunc(rpc[1])
    if f == nil {
        // TODO(rsc): Probably a bug?
        // The C version said "have retpc at least"
        // but actually returned pc=0.
        ok = true
        return
    }

So it is clearly possible for the gc version of runtime.Caller to return ok ==
true with no actual information.

However, since this is apparently common with gc, and apparently happens with
gccgo (though I don't know why--it would be nice to report that as a separate
bug) I'll adjust gccgo.


More information about the Gcc-bugs mailing list