[Bug go/64876] Regressions in gcc-testresults for powerpc64 gccgo in 5.0 due to change for static chain for closures (219776)
ian at airs dot com
gcc-bugzilla@gcc.gnu.org
Tue Feb 3 04:29:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64876
--- Comment #4 from Ian Lance Taylor <ian at airs dot com> ---
This code is going to call main.$nested0 with the static chain pointer set to
the address of a struct created in main.for_escapes3. In this code
p := new(int)
*p = i
f[n] = func() *int { return p }
the struct will have a single field which will hold the address of p, and
main.$nested0, which is the "func() *int { return p }", will simply return an
indirection through the first field of that struct.
The static chain is set in gcc/go/go-gcc.cc in the function
Gcc_backend::call_expression by setting CALL_EXPR_STATIC_CHAIN. The value is
picked up in the nested function by a parameter created by
Gcc_backend::static_chain_variable, a parameter stored in the functions
DECL_STATIC_CHAIN field.
So for some reason the value passed in CALL_EXPR_STATIC_CHAIN is not being
picked up by the parameter stored in the function's DECL_STATIC_CHAIN. That
seems like a problem, but it doesn't seem like a problem in the Go front end.
More information about the Gcc-bugs
mailing list