This patch by Chris Manghane fixes a compiler crash on an invalid program when the compiler tries to set a numeric constant to an invalid type. This fixes https://golang.org/issue/11537. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 227201) +++ gcc/go/gofrontend/MERGE (working copy) @@ -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. Index: gcc/go/gofrontend/expressions.cc =================================================================== --- gcc/go/gofrontend/expressions.cc (revision 227201) +++ gcc/go/gofrontend/expressions.cc (working copy) @@ -15150,7 +15150,11 @@ Numeric_constant::set_type(Type* type, b 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;