aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-02-15 14:33:45 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-02-15 14:33:45 +0000
commitf3fb416a935dd10b8d2ab463a5a45981fb1b94cd (patch)
treea115cf9c579b75d5b8a719d3d138971428779115 /gcc
parent65728e39baeb1aa7492737cd55bbd233d7df5060 (diff)
downloadgcc-f3fb416a935dd10b8d2ab463a5a45981fb1b94cd.zip
gcc-f3fb416a935dd10b8d2ab463a5a45981fb1b94cd.tar.gz
gcc-f3fb416a935dd10b8d2ab463a5a45981fb1b94cd.tar.bz2
compiler: Avoid crashes on erroneous input.
From-SVN: r184274
Diffstat (limited to 'gcc')
-rw-r--r--gcc/go/gofrontend/backend.h4
-rw-r--r--gcc/go/gofrontend/gogo.cc5
-rw-r--r--gcc/go/gofrontend/types.cc10
3 files changed, 15 insertions, 4 deletions
diff --git a/gcc/go/gofrontend/backend.h b/gcc/go/gofrontend/backend.h
index 2605ffe..d314045 100644
--- a/gcc/go/gofrontend/backend.h
+++ b/gcc/go/gofrontend/backend.h
@@ -126,7 +126,9 @@ class Backend
// Fill in a placeholder pointer type as a pointer. This takes a
// type returned by placeholder_pointer_type and arranges for it to
- // point to to_type. Returns true on success, false on failure.
+ // point to the type that TO_TYPE points to (that is, PLACEHOLDER
+ // becomes the same type as TO_TYPE). Returns true on success,
+ // false on failure.
virtual bool
set_placeholder_pointer_type(Btype* placeholder, Btype* to_type) = 0;
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index fafd04f..a1b03ac 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -4180,6 +4180,11 @@ Variable::get_backend_variable(Gogo* gogo, Named_object* function,
package != NULL,
Gogo::is_hidden_name(name),
this->location_);
+ else if (function == NULL)
+ {
+ go_assert(saw_errors());
+ bvar = backend->error_variable();
+ }
else
{
tree fndecl = function->func_value()->get_decl();
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index 41bf491..1a35e54d 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -3595,7 +3595,7 @@ Pointer_type::do_hash_for_method(Gogo* gogo) const
return this->to_type_->hash_for_method(gogo) << 4;
}
-// The tree for a pointer type.
+// Get the backend representation for a pointer type.
Btype*
Pointer_type::do_get_backend(Gogo* gogo)
@@ -5345,6 +5345,7 @@ Array_type::do_get_backend(Gogo* gogo)
}
// Return the backend representation of the element type.
+
Btype*
Array_type::get_backend_element(Gogo* gogo)
{
@@ -7567,6 +7568,11 @@ Find_type_use::type(Type* type)
this->find_type_->add_dependency(type->named_type());
break;
+ case Type::TYPE_NAMED:
+ case Type::TYPE_FORWARD:
+ go_assert(saw_errors());
+ break;
+
case Type::TYPE_VOID:
case Type::TYPE_SINK:
case Type::TYPE_FUNCTION:
@@ -7575,8 +7581,6 @@ Find_type_use::type(Type* type)
case Type::TYPE_MAP:
case Type::TYPE_CHANNEL:
case Type::TYPE_INTERFACE:
- case Type::TYPE_NAMED:
- case Type::TYPE_FORWARD:
default:
go_unreachable();
}