This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Go patch committed: Make top-level decl for address-taken non-escaping locals


In the Go frontend, if a local variable's address is taken and passed
out of its lexical scope, the GCC middle-end may reuse the stack slot
for the variable, not knowing it is still live through a pointer.
This patch by Cherry Zhang creates 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.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian

2018-01-09  Cherry Zhang  <cherryyz@google.com>

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

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]