From: prj@po.cwru.edu (Paul Jarc)
To: Joe Buck <Joe.Buck@synopsys.COM>
Cc: Steve Ellcey <sje@cup.hp.com>, gcc@gcc.gnu.org
Subject: Re: memcpy / Language Lawyer / optimization question
Date: Thu, 09 Dec 2004 19:52:00 -0000 [thread overview]
Message-ID: <m3llc745bj.fsf@multivac.cwru.edu> (raw)
In-Reply-To: <20041209114105.B32427@synopsys.com> (Joe Buck's message of "Thu, 9 Dec 2004 11:41:05 -0800")
Joe Buck <Joe.Buck@synopsys.COM> wrote:
> On Thu, Dec 09, 2004 at 11:32:55AM -0800, Steve Ellcey wrote:
>> I have a question about memcpy and when it is legal to turn it into a
>> simple assignment. The first memcpy in the program below will cause an
>> abort on IA64 when compiled with -O2 because it gets turned into integer
>> assignment and p is not properly aligned. I think this is OK.
>
> No, it's not OK; you are lying to the compiler and paying for the offense.
I think he's saying the crash is ok in this case, not the code.
> By declaring the return value of foo to be a pointer to int, you are
> promising that the return value will be aligned. It isn't, therefore you
> get a crash.
Is it expected that a (char*) cast avoids the crash, while a (void*)
cast does not?
paul
next prev parent reply other threads:[~2004-12-09 19:52 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 [this message]
2004-12-09 20:11 ` Gabriel Dos Reis
2004-12-09 20:14 ` Joe Buck
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=m3llc745bj.fsf@multivac.cwru.edu \
--to=prj@po.cwru.edu \
--cc=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).