public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexander Monakov <amonakov@ispras.ru>
To: Nathan Sidwell <nathan@acm.org>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [gomp-nvptx 3/5] nvptx backend: set up stacks in entry code
Date: Mon, 22 Feb 2016 20:25:00 -0000	[thread overview]
Message-ID: <alpine.LNX.2.20.1602222318320.13825@monopod.intra.ispras.ru> (raw)
In-Reply-To: <56CB3539.6050200@acm.org>

On Mon, 22 Feb 2016, Nathan Sidwell wrote:
> On 02/15/16 13:44, Alexander Monakov wrote:
> > This patch implements the NVPTX backend part of the transition to
> 
> > +  static const char template64[] = ENTRY_TEMPLATE ("64", "8",
> > "mad.wide.u32");
> > +  static const char template32[] = ENTRY_TEMPLATE ("32", "4", "mad.lo.u32
> > ");
> > +#undef ENTRY_TEMPLATE
> > +  const char *template_1 = TARGET_ABI64 ? template64 : template32;
> > +  const char *template_2 = template_1 + strlen (template64) + 1;
>                                          ^^^
> this looks mighty suspicious -- are you presuming some specific placement of
> template64 & template32? (and even then I  think it'll only work for
> TARGET_ABI64)

Template strings have an embedded nul character at the position where ORIG
goes, so template_2 is set to point at the position following the embedded nul
in template_1.  Offset of the embedded nul is the same in each template
string, so it doesn't matter which goes into the argument of strlen (but
supplying template64 or template32 instead of template_1 allows easier folding).

Alexander

  reply	other threads:[~2016-02-22 20:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15 18:44 [gomp-nvptx 0/5] Reorganize soft-stack setup Alexander Monakov
2016-02-15 18:44 ` [gomp-nvptx 2/5] Revert "nvptx plugin: bump heap size to 1GB" Alexander Monakov
2016-02-15 18:44 ` [gomp-nvptx 1/5] libgomp plugin: correct types Alexander Monakov
2016-02-15 18:44 ` [gomp-nvptx 5/5] libgomp plugin: manage soft-stack storage Alexander Monakov
2016-02-15 18:44 ` [gomp-nvptx 4/5] libgomp: remove __nvptx_stacks setup code Alexander Monakov
2016-02-15 18:44 ` [gomp-nvptx 3/5] nvptx backend: set up stacks in entry code Alexander Monakov
2016-02-22 16:20   ` Nathan Sidwell
2016-02-22 20:25     ` Alexander Monakov [this message]
2016-02-22 20:31       ` Nathan Sidwell
2016-02-23  7:56         ` Alexander Monakov

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=alpine.LNX.2.20.1602222318320.13825@monopod.intra.ispras.ru \
    --to=amonakov@ispras.ru \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=nathan@acm.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).