From: David Mosberger <davidm@napali.hpl.hp.com>
To: linux-ia64@vger.kernel.org
Subject: Re: gcc builtin memcpy is bogus?
Date: Mon, 08 Dec 2003 17:29:03 +0000 [thread overview]
Message-ID: <marc-linux-ia64-107090506304484@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-107090003129207@msgid-missing>
>>>>> On Mon, 8 Dec 2003 16:01:24 +0000, Matthew Wilcox <willy@debian.org> said:
Matthew> This is a fun one ... I don't know what to blame for this.
Matthew> struct rfd {
Matthew> u16 status;
Matthew> u16 command;
Matthew> u32 link;
Matthew> u32 rbd;
Matthew> u16 actual_size;
Matthew> u16 size;
Matthew> };
Matthew> The kernel doesn't use -fno-builtin or -fno-builtin-memcpy
Matthew> so it attempts to optimise this by doing 4-byte loads and
Matthew> stores. Problem is, the destination is misaligned
Matthew> (deliberately), so the kernel emits unaligned messages.
Matthew> Adding -fno-builtin to the command line turns this back
Matthew> into a call to memcpy.
The code is wrong. If it's 2-byte aligned, use
attribute ((packed) (aligned (2))
to mark it as such (check on the syntax of the attributes, I probably
got it wrong).
--david
next prev parent reply other threads:[~2003-12-08 17:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-08 16:01 gcc builtin memcpy is bogus? Matthew Wilcox
2003-12-08 16:25 ` Andreas Schwab
2003-12-08 17:29 ` David Mosberger [this message]
2003-12-08 20:27 ` Matthew Wilcox
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=marc-linux-ia64-107090506304484@msgid-missing \
--to=davidm@napali.hpl.hp.com \
--cc=linux-ia64@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.