From owner-freebsd-alpha@FreeBSD.ORG Sun Mar 14 23:01:51 2004 Return-Path: Delivered-To: freebsd-alpha@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2CE5416A4CE for ; Sun, 14 Mar 2004 23:01:51 -0800 (PST) Received: from smtp1.jp.viruscheck.net (smtp1.jp.viruscheck.net [154.33.69.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id E747843D48 for ; Sun, 14 Mar 2004 23:01:50 -0800 (PST) (envelope-from bland@freebsd.org) Received: from scan1.jp.viruscheck.net ([154.33.69.36] helo=mail4.jp.viruscheck.net) by smtp1.jp.viruscheck.net with esmtp (Exim 3.36 #1) id 1B2m6c-00032j-00 for alpha@freebsd.org; Mon, 15 Mar 2004 16:01:46 +0900 Received: from [219.167.14.54] (helo=noc.orchid) by mail4.jp.viruscheck.net with esmtp (Exim 3.36 #3) id 1B2m6c-0001Vy-00 for alpha@FreeBSD.org; Mon, 15 Mar 2004 16:01:46 +0900 Received: from FreeBSD.org (horse.orchid [89.60.10.11]) by noc.orchid (8.12.11/8.12.11) with ESMTP id i2F71jta049207 for ; Mon, 15 Mar 2004 16:01:45 +0900 (JST) (envelope-from bland@FreeBSD.org) Message-ID: <405554D9.4000208@FreeBSD.org> Date: Mon, 15 Mar 2004 16:01:45 +0900 From: Alexander Nedotsukov User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7a) Gecko/20040219 X-Accept-Language: en-us, en MIME-Version: 1.0 To: alpha@FreeBSD.org Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Subject: Is the way static data alligned correct? X-BeenThere: freebsd-alpha@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Alpha List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2004 07:01:51 -0000 Guys, Recently doing some development I hit alignment problem on alpha machines. Problem solved but the way I did it in fact the reason why I asking pros to judge who is wrong here. Inside code I have linked-in data blocks generated by external tool. They looks like this: const unsigned char raw_data_block[] = { bla-bla-bla }; Internal block content is 8 bytes aligned. Each block resides in a single .c file. So after compilation I have a set of .o files linked later into single shared object (library). Taking an address of such data block and casting it to pointer to some real structure was a problem because it is not necesary 8 byte aligned. Obvious solution was to ask explicitly for such alignment: const unsigned char raw_data_block[] __attribute__ ((alligned(8))) = { bla-bla-bla }; But I wonder is this gcc bug or space optimization for char arrays only? Thanks, Alexander.