diff mbox

Go patch committed: Fix last conversion patch

Message ID mcrsjkowbh5.fsf@dhcp-172-18-216-180.mtv.corp.google.com
State New
Headers show

Commit Message

Ian Lance Taylor Dec. 13, 2011, 6:52 p.m. UTC
I came across a test case which showed that the conversion patch I just
committed did not always use the correct types--it got a gimplification
failure.  The problem was that the builtin call was being recorded as
returning the type for which it was first called, and that might be
different from some later type.  Since all types it will be used with
will always look exactly the same, I just avoided the error by avoiding
the caching.  This code will be changed in the future to use the new
Runtime::make_call interface anyhow.  Bootstrapped and ran Go testsuite
on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian
diff mbox

Patch

diff -r 61ab46b28b40 go/expressions.cc
--- a/go/expressions.cc	Tue Dec 13 10:08:46 2011 -0800
+++ b/go/expressions.cc	Tue Dec 13 10:38:21 2011 -0800
@@ -3669,7 +3669,7 @@ 
       if (e->integer_type()->is_unsigned()
 	  && e->integer_type()->bits() == 8)
 	{
-	  static tree string_to_byte_array_fndecl;
+	  tree string_to_byte_array_fndecl = NULL_TREE;
 	  ret = Gogo::call_builtin(&string_to_byte_array_fndecl,
 				   this->location(),
 				   "__go_string_to_byte_array",
@@ -3681,7 +3681,7 @@ 
       else
 	{
 	  go_assert(e == Type::lookup_integer_type("int"));
-	  static tree string_to_int_array_fndecl;
+	  tree string_to_int_array_fndecl = NULL_TREE;
 	  ret = Gogo::call_builtin(&string_to_int_array_fndecl,
 				   this->location(),
 				   "__go_string_to_int_array",