public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@golang.org>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
		"gofrontend-dev@googlegroups.com"
	<gofrontend-dev@googlegroups.com>
Subject: Re: Fwd: libgo patch committed: Use -fgo-c-header to share between Go and C
Date: Fri, 09 Sep 2016 16:44:00 -0000	[thread overview]
Message-ID: <CAOyqgcXsERrR8dFCryUdnm9+W2nc0sFDS98iGLvgp1HibYEyBQ@mail.gmail.com> (raw)
In-Reply-To: <87h99pp4dk.fsf@linux-m68k.org>

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

On Fri, Sep 9, 2016 at 6:52 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>
> You should use alignof(ucontext_t) instead of hardcoding 16.

Fair enough.  Done like so.  Bootstrapped and ran Go testsuite on
x86_64-pc-linux-gnu, committed to mainline.

Ian

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

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 240045)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@
-b37a9e66ea584885043240f8f6f1d1c0284eadec
+6c1f159cdcb56ebff617f6bbc6c97943a1a8a34d
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/runtime/proc.c
===================================================================
--- libgo/runtime/proc.c	(revision 240045)
+++ libgo/runtime/proc.c	(working copy)
@@ -166,7 +166,13 @@ static ucontext_t*
 ucontext_arg(void** go_ucontext)
 {
 	uintptr_t p = (uintptr_t)go_ucontext;
-	p = (p + 15) &~ (uintptr_t)0xf;
+	size_t align = __alignof__(ucontext_t);
+	if(align > 16) {
+		// We only ensured space for up to a 16 byte alignment
+		// in libgo/go/runtime/runtime2.go.
+		runtime_throw("required alignment of ucontext_t too large");
+	}
+	p = (p + align - 1) &~ (uintptr_t)(align - 1);
 	return (ucontext_t*)p;
 }
 

      reply	other threads:[~2016-09-09 16:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAOyqgcUb2T0NkeffcN9SwbvQyWA0eqvi+BcAWAU4iiM9qmHb1w@mail.gmail.com>
2016-08-30 21:14 ` Ian Lance Taylor
2016-09-02 16:15   ` Andreas Schwab
2016-09-02 16:18     ` Ian Lance Taylor
2016-09-02 16:28       ` Andreas Schwab
2016-09-02 16:32         ` Andreas Schwab
2016-09-09 13:52         ` Ian Lance Taylor
2016-09-09 13:59           ` Andreas Schwab
2016-09-09 16:44             ` Ian Lance Taylor [this message]

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=CAOyqgcXsERrR8dFCryUdnm9+W2nc0sFDS98iGLvgp1HibYEyBQ@mail.gmail.com \
    --to=iant@golang.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gofrontend-dev@googlegroups.com \
    --cc=schwab@linux-m68k.org \
    /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).