compiler: make top-level decl for address-taken non-escaping locals
commit1f33ab41eb9228a28350ad8957108acc210b31a0
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Jan 2018 21:33:59 +0000 (9 21:33 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Jan 2018 21:33:59 +0000 (9 21:33 +0000)
treed85e4d07a55f301cdce0f9af88f503c2cc802899
parent442c4003f392305636769a94843dbc092f045a40
compiler: make top-level decl for address-taken non-escaping locals

    If a local variable's address is taken and passed out of its
    lexical scope, GCC backend may reuse the stack slot for the
    variable, not knowing it is still live through a pointer. In
    this case, we create a top-level temporary variable and let the
    user-defined variable refer to the temporary variable as its
    storage location. As the temporary variable is declared at the
    top level, its stack slot will remain live throughout the
    function.

    Reviewed-on: https://go-review.googlesource.com/84675

* go-gcc.cc (local_variable): Add decl_var parameter.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@256398 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/go/ChangeLog
gcc/go/go-gcc.cc
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/backend.h
gcc/go/gofrontend/gogo.cc
gcc/go/gofrontend/gogo.h