public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joe Buck <Joe.Buck@synopsys.COM>
To: Steve Ellcey <sje@cup.hp.com>
Cc: gcc@gcc.gnu.org
Subject: Re: memcpy / Language Lawyer / optimization question
Date: Thu, 09 Dec 2004 20:14:00 -0000	[thread overview]
Message-ID: <20041209121405.A5662@synopsys.com> (raw)
In-Reply-To: <200412091932.LAA06762@hpsje.cup.hp.com>; from sje@cup.hp.com on Thu, Dec 09, 2004 at 11:32:55AM -0800

On Thu, Dec 09, 2004 at 11:32:55AM -0800, Steve Ellcey wrote:
> [ unaligned int and memcpy ]
...
> I ran into this in the libgfortran where I am trying to replace an
> assignment of a long into a (possibly) unaligned buffer with a call to
> memcpy.

I misunderstood your original question.  The issue of lying to the
compiler is still an important matter: if the user calls memcpy, a
standard function, the compiler is allowed to optimize it based on the
rules of C.  It is very dangerous to find a case that gcc currently
does not optimize, and rely on this to do aligned word copies, because
future work on gcc is likely to break this.

One approach would be to force a call to the real memcpy.  Ideally, there
would be a hook that would specify that an unaligned transfer must be
done, even in a case that appears aligned based on the type system.

  parent reply	other threads:[~2004-12-09 20:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-09 19:33 Steve Ellcey
2004-12-09 19:41 ` Joe Buck
2004-12-09 19:52   ` Paul Jarc
2004-12-09 20:11 ` Gabriel Dos Reis
2004-12-09 20:14 ` Joe Buck [this message]
2004-12-09 20:20 ` Joseph S. Myers
2004-12-10 16:51   ` Steve Ellcey
2004-12-09 22:54 Paul Schlie
2004-12-09 23:36 ` Geoffrey Keating
2004-12-09 23:53 ` Joe Buck
2004-12-10  3:18   ` Paul Schlie

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=20041209121405.A5662@synopsys.com \
    --to=joe.buck@synopsys.com \
    --cc=gcc@gcc.gnu.org \
    --cc=sje@cup.hp.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).