aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2017-03-28 20:08:31 +0000
committerIan Lance Taylor <iant@google.com>2017-03-28 20:08:31 +0000
commitf9b0d669980d401a59b4ef2d9d3fdbf0fe7a812e (patch)
treedac722570cfe68a1d0e7d43f5a30c1f1158f71e5
parent271f1584b183b03a7c63b9456a5fc400952d0c9d (diff)
PR go/80226
* go-gcc.cc (Gcc_backend::return_statement): Check for void_type_node when checking result size. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@246553 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/go/ChangeLog6
-rw-r--r--gcc/go/go-gcc.cc3
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog
index 8958f762fcf..55d78efd947 100644
--- a/gcc/go/ChangeLog
+++ b/gcc/go/ChangeLog
@@ -1,3 +1,9 @@
+2017-03-28 Than McIntosh <thanm@google.com>
+
+ PR go/80226
+ * go-gcc.cc (Gcc_backend::return_statement): Check for
+ void_type_node when checking result size.
+
2017-02-20 Ian Lance Taylor <iant@golang.org>
PR go/79642
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index ed6fc2c6105..62baa91fab8 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -2081,7 +2081,8 @@ Gcc_backend::return_statement(Bfunction* bfunction,
// If the result size is zero bytes, we have set the function type
// to have a result type of void, so don't return anything.
// See the function_type method.
- if (int_size_in_bytes(TREE_TYPE(result)) == 0)
+ tree res_type = TREE_TYPE(result);
+ if (res_type == void_type_node || int_size_in_bytes(res_type) == 0)
{
tree stmt_list = NULL_TREE;
for (std::vector<Bexpression*>::const_iterator p = vals.begin();