summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-26 19:18:51 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-26 19:18:51 +0000
commit5706ab685584b7d3ce2f87d9b2815dcc7fe11c17 (patch)
tree3470b98759341615e593b46dbfdecf711407f53c
parent7ebdc8814144cabb6224f5a50e1bddb357f15fe8 (diff)
downloadgcc-5706ab685584b7d3ce2f87d9b2815dcc7fe11c17.tar.gz
compiler: Don't crash on invalid arithmetic ops.
The gofrontend would crash after hitting an unreachable state while trying to determine the type of an arithmetic expression involving non-numeric values. Instead of crashing, it should fail gracefully if the relevant error is already reported. Fixes golang/go#11537. Reviewed-on: https://go-review.googlesource.com/13793 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227227 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/expressions.cc6
2 files changed, 6 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index ff77fd1e82e..b3fcc04206f 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-d5e6af4e6dd456075a1ec1c03d0dc41cbea5eb36
+cd5362c7bb0b207f484a8dfb8db229fd2bffef09
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index c9323f5625d..79b772e20a2 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -15150,7 +15150,11 @@ Numeric_constant::set_type(Type* type, bool issue_error, Location loc)
else if (type->complex_type() != NULL)
ret = this->check_complex_type(type->complex_type(), issue_error, loc);
else
- go_unreachable();
+ {
+ ret = false;
+ if (issue_error)
+ go_assert(saw_errors());
+ }
if (ret)
this->type_ = type;
return ret;