OSDN Git Service

compiler: fix crashes.
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 28 Mar 2012 21:33:37 +0000 (21:33 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 28 Mar 2012 21:33:37 +0000 (21:33 +0000)
The compiler would crash on:
        if true || x, y := 1, 2 {}
and
        var s string
        s = append(s, "hello")

Reported in issue 3186.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@185929 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/go/gofrontend/expressions.cc
gcc/go/gofrontend/parse.cc

index 4c493f8..f2a81de 100644 (file)
@@ -7441,6 +7441,8 @@ Builtin_call_expression::check_one_arg()
 void
 Builtin_call_expression::do_check_types(Gogo*)
 {
+  if (this->is_error_expression())
+    return;
   switch (this->code_)
     {
     case BUILTIN_INVALID:
index 1a9c153..7207db5 100644 (file)
@@ -3971,7 +3971,7 @@ Parse::if_stat()
 
   bool saw_simple_stat = false;
   Expression* cond = NULL;
-  bool saw_send_stmt;
+  bool saw_send_stmt = false;
   if (this->simple_stat_may_start_here())
     {
       cond = this->simple_stat(false, &saw_send_stmt, NULL, NULL);