go-gcc.cc (Gcc_backend::stack_allocation_expression): Clear the returned memory.
authorChris Manghane <cmang@google.com>
Thu, 6 Oct 2016 19:24:04 +0000 (19:24 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Thu, 6 Oct 2016 19:24:04 +0000 (19:24 +0000)
* go-gcc.cc (Gcc_backend::stack_allocation_expression): Clear the
returned memory.

From-SVN: r240840

gcc/go/ChangeLog
gcc/go/go-gcc.cc

index 7292b2b93cc4cb90cdd47c40dfe88b494592f994..b6d1e9f9416fefd2eca7b2618bbeadff9b87f49a 100644 (file)
@@ -1,3 +1,8 @@
+2016-10-06  Chris Manghane  <cmang@google.com>
+
+       * go-gcc.cc (Gcc_backend::stack_allocation_expression): Clear the
+       returned memory.
+
 2016-09-27  Than McIntosh  <thanm@google.com>
 
        * go-linemap.cc (Gcc_linemap::to_string): New method.
index 57c2bee7a5890e8f625af7fbde99805f3b6b8b3c..b3701bf31e4820e7f4fae8642b63fc3c4d6cec92 100644 (file)
@@ -2048,6 +2048,9 @@ Gcc_backend::stack_allocation_expression(int64_t size, Location location)
   tree alloca = builtin_decl_explicit(BUILT_IN_ALLOCA);
   tree size_tree = build_int_cst(integer_type_node, size);
   tree ret = build_call_expr_loc(location.gcc_location(), alloca, 1, size_tree);
+  tree memset = builtin_decl_explicit(BUILT_IN_MEMSET);
+  ret = build_call_expr_loc(location.gcc_location(), memset, 3,
+                            ret, integer_zero_node, size_tree);
   return this->make_expression(ret);
 }