aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-01-19 05:38:41 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-01-19 05:38:41 +0000
commitd4d2a98fb267ed59fad4a1d2e7bfe92ac7f6a071 (patch)
tree5df84fea89e0522ef6be3f81ea50b863d6790cca /gcc/go
parent8386b63d3d95d4e14f220058c2c4a97044cafcc8 (diff)
downloadgcc-d4d2a98fb267ed59fad4a1d2e7bfe92ac7f6a071.zip
gcc-d4d2a98fb267ed59fad4a1d2e7bfe92ac7f6a071.tar.gz
gcc-d4d2a98fb267ed59fad4a1d2e7bfe92ac7f6a071.tar.bz2
Don't crash using value of something with no value.
From-SVN: r168982
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/types.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index dd0a861..840de2b 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -482,6 +482,15 @@ bool
Type::are_assignable(const Type* lhs, const Type* rhs, std::string* reason)
{
// Do some checks first. Make sure the types are defined.
+ if (rhs != NULL
+ && rhs->forwarded()->forward_declaration_type() == NULL
+ && rhs->is_void_type())
+ {
+ if (reason != NULL)
+ *reason = "non-value used as value";
+ return false;
+ }
+
if (lhs != NULL && lhs->forwarded()->forward_declaration_type() == NULL)
{
// Any value may be assigned to the blank identifier.