public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Go patch committed: don't crash returning multiple zero-sized values
@ 2017-03-28 20:57 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2017-03-28 20:57 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

In GCC PR 80226 Than reports a Go frontend crash when compiling a
function that returns multiple zero-sized values.  This patch that he
wrote fixes the problem.  Bootstrapped and ran Go testsuite on
x86_64-pc-linux-gnu.  Committed to mainline.

Ian


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.

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 672 bytes --]

Index: gcc/go/go-gcc.cc
===================================================================
--- gcc/go/go-gcc.cc	(revision 246552)
+++ gcc/go/go-gcc.cc	(working copy)
@@ -2081,7 +2081,8 @@ Gcc_backend::return_statement(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();

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-03-28 20:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-28 20:57 Go patch committed: don't crash returning multiple zero-sized values 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).