* Go patch committed: Fix a few compiler crashes
@ 2012-04-28 4:59 Ian Lance Taylor
0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2012-04-28 4:59 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 206 bytes --]
This patch to the Go frontend fixes a few cases where the compiler was
crashing on invalid code. Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu. Committed to mainline and 4.7 branch.
Ian
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1510 bytes --]
diff -r cc46c1bb0278 go/expressions.cc
--- a/go/expressions.cc Fri Apr 27 17:28:13 2012 -0700
+++ b/go/expressions.cc Fri Apr 27 21:51:48 2012 -0700
@@ -9225,7 +9225,7 @@
ref->set_is_lvalue();
tree temp_tree = ref->get_tree(context);
if (temp_tree == error_mark_node)
- continue;
+ return error_mark_node;
tree val_tree = build3_loc(loc.gcc_location(), COMPONENT_REF,
TREE_TYPE(field), call_tree, field, NULL_TREE);
diff -r cc46c1bb0278 go/types.cc
--- a/go/types.cc Fri Apr 27 17:28:13 2012 -0700
+++ b/go/types.cc Fri Apr 27 21:51:48 2012 -0700
@@ -5450,6 +5450,11 @@
mpz_t val;
if (this->length_->numeric_constant_value(&nc) && nc.to_int(&val))
{
+ if (mpz_sgn(val) < 0)
+ {
+ this->length_tree_ = error_mark_node;
+ return this->length_tree_;
+ }
Type* t = nc.type();
if (t == NULL)
t = Type::lookup_integer_type("int");
@@ -6551,7 +6556,11 @@
Interface_type::is_identical(const Interface_type* t,
bool errors_are_identical) const
{
- go_assert(this->methods_are_finalized_ && t->methods_are_finalized_);
+ // If methods have not been finalized, then we are asking whether
+ // func redeclarations are the same. This is an error, so for
+ // simplicity we say they are never the same.
+ if (!this->methods_are_finalized_ || !t->methods_are_finalized_)
+ return false;
// We require the same methods with the same types. The methods
// have already been sorted.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-04-28 4:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-28 4:59 Go patch committed: Fix a few compiler crashes Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).