diff mbox

Go patch committed: Mark erroneous builtin calls as erroneous

Message ID CAOyqgcVGkcepCkDSfQAgSGGEtQ72AK-ES5ziNE0tyBzrUpfSHQ@mail.gmail.com
State New
Headers show

Commit Message

Ian Lance Taylor March 31, 2015, 12:10 a.m. UTC
This patch to the Go frontend marks some builtin calls with erroneous
as erroneous.  This avoids a compiler crash on invalid code
(http://golang.org/issue/10285).  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian
diff mbox

Patch

diff -r 6780bf5a7069 go/expressions.cc
--- a/go/expressions.cc	Mon Mar 30 10:30:44 2015 -0700
+++ b/go/expressions.cc	Mon Mar 30 17:07:15 2015 -0700
@@ -7887,7 +7887,10 @@ 
 	Type* arg1_type = args->front()->type();
 	Type* arg2_type = args->back()->type();
 	if (arg1_type->is_error() || arg2_type->is_error())
-	  break;
+	  {
+	    this->set_is_error();
+	    break;
+	  }
 
 	Type* e1;
 	if (arg1_type->is_slice_type())
@@ -7929,7 +7932,10 @@ 
 	  }
 	if (args->front()->type()->is_error()
 	    || args->back()->type()->is_error())
-	  break;
+	  {
+	    this->set_is_error();
+	    break;
+	  }
 
 	Array_type* at = args->front()->type()->array_type();
 	Type* e = at->element_type();