From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5028 invoked by alias); 2 Aug 2005 21:34:41 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 5015 invoked by uid 22791); 2 Aug 2005 21:34:37 -0000 Received: from us01smtp1.synopsys.com (HELO boden.synopsys.com) (198.182.44.79) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 02 Aug 2005 21:34:37 +0000 Received: from maiden.synopsys.com (maiden.synopsys.com [146.225.100.170]) by boden.synopsys.com (Postfix) with ESMTP id 43E94DC5F; Tue, 2 Aug 2005 14:33:32 -0700 (PDT) Received: from piper.synopsys.com (localhost [127.0.0.1]) by maiden.synopsys.com (8.9.1/8.9.1) with ESMTP id OAA26497; Tue, 2 Aug 2005 14:34:34 -0700 (PDT) Received: from piper.synopsys.com (localhost [127.0.0.1]) by piper.synopsys.com (8.12.10/8.12.3) with ESMTP id j72LYYOe000768; Tue, 2 Aug 2005 14:34:34 -0700 Received: (from jbuck@localhost) by piper.synopsys.com (8.12.10/8.12.10/Submit) id j72LYYbJ000766; Tue, 2 Aug 2005 14:34:34 -0700 Date: Tue, 02 Aug 2005 21:34:00 -0000 From: Joe Buck To: Mike Stump Cc: Ian Lance Taylor , Andrew Pinski , Dave Korn , Paul Koning , gcc@sources.redhat.com, Shaun Jackman Subject: Re: memcpy to an unaligned address Message-ID: <20050802213434.GD30893@synopsys.com> References: <200508022037.j72Kbr4T012558@earth.phy.uc.edu> <4AE0FF52-B95D-40D7-B49E-831534AD3CC8@apple.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4AE0FF52-B95D-40D7-B49E-831534AD3CC8@apple.com> User-Agent: Mutt/1.4.1i X-SW-Source: 2005-08/txt/msg00091.txt.bz2 On Tue, Aug 02, 2005 at 02:29:44PM -0700, Mike Stump wrote: > On Aug 2, 2005, at 1:45 PM, Ian Lance Taylor wrote: > >That argument doesn't make sense to me. memcpy takes a void* > >argument, which has no presumed alignment. > > The memcpy builtin uses the static type of the actual argument > (before conversion to void*), to gain hints about the alignments of > the data coming in. This is so that we can producing nice fast code > for 1-16 bytes objects. This is actually good. The real problem is > formation of the address of the member doesn't produce a pointer to > unaligned type, but rather a pointer to aligned type, this is the > part that is wrong. We'd have to add pointers to unaligned data to > our type system to fix it. That should be done, but is a hard/big > job, and no one has stepped forward to do it. So my suggestion to just make pointers to unaligned objects void* would work in this case, then.