From owner-freebsd-alpha Thu Aug 2 13:52: 4 2001 Delivered-To: freebsd-alpha@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 0D4AC37B401; Thu, 2 Aug 2001 13:51:56 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id GAA09412; Fri, 3 Aug 2001 06:51:28 +1000 Date: Fri, 3 Aug 2001 06:48:54 +1000 (EST) From: Bruce Evans X-X-Sender: To: Julian Elischer Cc: Brian Somers , Thomas Pornin , , , Brian Somers , Subject: Re: kern/27767: (was: PPPoE + Alpha + 32/64 bits) In-Reply-To: Message-ID: <20010803054935.M2890-100000@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Thu, 2 Aug 2001, Julian Elischer wrote: > care to explain? Please trim quotes and reply after the quoted section[s]. > On Fri, 3 Aug 2001, Bruce Evans wrote: > > > On Wed, 1 Aug 2001, Brian Somers wrote: > > > > @@ -910,7 +910,7 @@ > > > > struct { > > > > struct pppoe_tag hdr; > > > > union uniq data; > > > > - } uniqtag; > > > > + } __attribute ((packed)) uniqtag; > > > > negp neg = NULL; > > > > struct mbuf *m; > > > > Obviously a syntax error. `__attribute ((packed))' is a syntax error in Standard C. Dependencies on compiler features are supposed to be centralized in places like . Many invocations of __attribute__(()) are placed there. This is not possible for the `packed' attribute because this attribute has non-cosmetic effects. Structs must be carefully laid out to give some chance of them not having any internal padding for any compiler. This sometimes involves using struct members with an unnatural type. has many examples. Here I don't see how packing the struct helps on alphas. Doesn't it cause traps by misaligning uniqtag.data.pointer? I think you need something like: struct { struct pppoe_tag hdr; char data[sizeof(void *)]; } uniqtag; void *pointer; ... pointer = sp; memcpy(uniqtag.data, &pointer, sizeof(uniqtag.data)); Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message