From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30484 invoked by alias); 2 Aug 2005 19:19:32 -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 30426 invoked by uid 22791); 2 Aug 2005 19:19:27 -0000 Received: from sadr.equallogic.com (HELO sadr.equallogic.com) (66.155.203.134) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 02 Aug 2005 19:19:27 +0000 Received: from sadr.equallogic.com (localhost.localdomain [127.0.0.1]) by sadr.equallogic.com (8.12.8/8.12.8) with ESMTP id j72JJPZd005632 for ; Tue, 2 Aug 2005 15:19:25 -0400 Received: from M31.equallogic.com (M31.equallogic.com [172.16.1.31]) by sadr.equallogic.com (8.12.8/8.12.8) with SMTP id j72JJPNd005627; Tue, 2 Aug 2005 15:19:25 -0400 Received: from pkoning.equallogic.com ([172.16.1.163]) by M31.equallogic.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 2 Aug 2005 15:19:24 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17135.51003.705531.520575@gargle.gargle.HOWL> Date: Tue, 02 Aug 2005 19:19:00 -0000 From: Paul Koning To: sjackman@gmail.com Cc: dave.korn@artimi.com, gcc@sources.redhat.com Subject: Re: memcpy to an unaligned address References: <7f45d9390508021032aea5a61@mail.gmail.com> <7f45d93905080212136ecb0cbb@mail.gmail.com> X-SW-Source: 2005-08/txt/msg00075.txt.bz2 One of the things that continues to baffle me (and my colleagues) is the bizarre way in which attributes such as "packed" work when applied to structs. It would be natural to assume, as Shaun did, that marking a struct "packed" (or, for that matter, "packed,aligned(2)") would apply that attribute to the fields of the struct. But it doesn't work that way. To get the right results, you have to stick attributes all over the structure fields, one by one. This is highly counterintuive. Worse yet, in this example the attribute is applied to the structure elements to some extent but not consistently -- it causes the fields to be packed -- hence unaligned -- but it does not do unaligned accesses to the fields. This sure looks like a bug. paul