This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: memcpy() inlining and alignment
- To: "David S. Miller" <davem at redhat dot com>
- Subject: Re: memcpy() inlining and alignment
- From: Jason Thorpe <thorpej at netbsd dot org>
- Date: Fri, 03 Mar 2000 17:22:06 -0800
- Cc: thorpej at netbsd dot org, gcc-bugs at gcc dot gnu dot org
- Reply-To: Jason Thorpe <thorpej at netbsd dot org>
On Fri, 3 Mar 2000 16:25:35 -0800
"David S. Miller" <davem@redhat.com> wrote:
> I believe the compiler is correctly assuming that the structure is
> aligned to whatever alignment is required by the members of the
> structure type for a particular processor's ABI. In this case, most
> likely the required alignment is 4 bytes on 32-bit systems.
>
> If this is the case, you'll need to create your own
> "memcpy_unaligned()" or similar interface for these specific
> cases.
I'm not sure I buy that. What you're effectively saying is:
There is no standard function in C that allows unaligned
data to be copied into an aligned buffer.
Personally, I have never encountered a libc implementation of memcpy()
that required data to be aligned in the way you're suggesting.
-- Jason R. Thorpe <thorpej@netbsd.org>