aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2017-09-14 03:53:21 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2017-09-14 03:53:21 +0000
commit0468f67f27f49972dcd77758284a2709bd9249fe (patch)
tree95c48d0c855c385039578f7ad9713a075758de44 /gcc
parent03ff36aa01bd359f74cbd1f2afec569ce0b77a15 (diff)
downloadgcc-0468f67f27f49972dcd77758284a2709bd9249fe.zip
gcc-0468f67f27f49972dcd77758284a2709bd9249fe.tar.gz
gcc-0468f67f27f49972dcd77758284a2709bd9249fe.tar.bz2
compiler: avoid compiler crash on invalid program
I encountered this crash while working on upgrading libgo to the 1.9 release. I no longer have the cause of the crash, but it doesn't much matter, as the policy for crash-on-invalid errors is to fix the crash but not bother to commit the invalid test case. Reviewed-on: https://go-review.googlesource.com/62750 From-SVN: r252748
Diffstat (limited to 'gcc')
-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 74a0dba..7c78efc 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-89e46ae0cde7bebd8e97434355c5b7e57d902613
+0176cbc6dbd2170bfe2eb8904b80ddfe4c946997
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 1e4d906..82de4d8 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -210,7 +210,11 @@ Expression::convert_type_to_interface(Type* lhs_type, Expression* rhs,
}
// This should have been checked already.
- go_assert(lhs_interface_type->implements_interface(rhs_type, NULL));
+ if (!lhs_interface_type->implements_interface(rhs_type, NULL))
+ {
+ go_assert(saw_errors());
+ return Expression::make_error(location);
+ }
// An interface is a tuple. If LHS_TYPE is an empty interface type,
// then the first field is the type descriptor for RHS_TYPE.