aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-02-22 03:01:29 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-02-22 03:01:29 +0000
commit48347769a17adb6e8fc67eafb36da3a06ca311e2 (patch)
treeff8a9fb64dff8185f088f36625d30f9d64f23445 /gcc/go
parent7b67393dfff95cd7739fdb872484f3878843e88d (diff)
downloadgcc-48347769a17adb6e8fc67eafb36da3a06ca311e2.zip
gcc-48347769a17adb6e8fc67eafb36da3a06ca311e2.tar.gz
gcc-48347769a17adb6e8fc67eafb36da3a06ca311e2.tar.bz2
Don't crash on erroneous type switch.
From-SVN: r170386
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/parse.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc
index fc8771c..abd75fb 100644
--- a/gcc/go/gofrontend/parse.cc
+++ b/gcc/go/gofrontend/parse.cc
@@ -3799,11 +3799,14 @@ Parse::switch_stat(const Label* label)
// This must be a TypeSwitchGuard.
switch_val = this->simple_stat(false, true, NULL,
&type_switch);
- if (!type_switch.found
- && !switch_val->is_error_expression())
+ if (!type_switch.found)
{
- error_at(id_loc, "expected type switch assignment");
- switch_val = Expression::make_error(id_loc);
+ if (switch_val == NULL
+ || !switch_val->is_error_expression())
+ {
+ error_at(id_loc, "expected type switch assignment");
+ switch_val = Expression::make_error(id_loc);
+ }
}
}
}