diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-09-14 03:53:21 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-09-14 03:53:21 +0000 |
commit | 2b8629dd599cad688d92b002d9d9a48d74b1b9c6 (patch) | |
tree | 95c48d0c855c385039578f7ad9713a075758de44 /gcc/go/gofrontend/expressions.cc | |
parent | b792515b79657006c2e5a5ee46d487b7cef3ff15 (diff) | |
download | gcc-2b8629dd599cad688d92b002d9d9a48d74b1b9c6.tar.gz |
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
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@252748 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/go/gofrontend/expressions.cc')
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 1e4d90647b8..82de4d815ab 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. |