From: Ian Lance Taylor <iant@golang.org>
To: gcc-patches <gcc-patches@gcc.gnu.org>,
"gofrontend-dev@googlegroups.com"
<gofrontend-dev@googlegroups.com>
Subject: Go patch committed: don't crash returning multiple zero-sized values
Date: Tue, 28 Mar 2017 20:57:00 -0000 [thread overview]
Message-ID: <CAOyqgcWqiorD0PafQzcOaq7DCZTrD0qNqSzRunmO28aMRKTHZg@mail.gmail.com> (raw)
[-- 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();
reply other threads:[~2017-03-28 20:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAOyqgcWqiorD0PafQzcOaq7DCZTrD0qNqSzRunmO28aMRKTHZg@mail.gmail.com \
--to=iant@golang.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=gofrontend-dev@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).