[gccgo] Allocate correct size when taking address of result variable
diff mbox

Message ID mcriq55yluk.fsf@google.com
State New
Headers show

Commit Message

Ian Taylor June 27, 2010, 7:29 a.m. UTC
This patch fixes a dumb bug: when allocating space in the heap when
taking the address of a result variable, I was always allocating the
size of a pointer.  This corrects the code to allocate the amount of
space required to store the variable.  Committed to gccgo branch.


diff mbox

diff -r b621e0b91da7 go/gogo-tree.cc
--- a/go/gogo-tree.cc	Sat Jun 26 17:10:37 2010 -0700
+++ b/go/gogo-tree.cc	Sun Jun 27 00:27:25 2010 -0700
@@ -918,9 +918,9 @@ 
 	      init = type->get_init_tree(gogo, false);
-		result_type = build_pointer_type(result_type);
 		tree space = gogo->allocate_memory(TYPE_SIZE_UNIT(result_type),
+		result_type = build_pointer_type(result_type);
 		tree subinit = type->get_init_tree(gogo, true);
 		if (subinit == NULL_TREE)
 		  init = fold_convert_loc(loc, result_type, space);