From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4510 invoked by alias); 8 Mar 2010 15:46:17 -0000 Received: (qmail 4500 invoked by uid 22791); 8 Mar 2010 15:46:16 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40 X-Spam-Check-By: sourceware.org Received: from mail-gw0-f47.google.com (HELO mail-gw0-f47.google.com) (74.125.83.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 08 Mar 2010 15:46:13 +0000 Received: by gwj23 with SMTP id 23so2081718gwj.20 for ; Mon, 08 Mar 2010 07:46:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.151.88.2 with SMTP id q2mr4341400ybl.75.1268063170840; Mon, 08 Mar 2010 07:46:10 -0800 (PST) In-Reply-To: References: Date: Mon, 08 Mar 2010 15:46:00 -0000 Message-ID: <84fc9c001003080746p775b14b4s105ed0ddbf4a2fb1@mail.gmail.com> Subject: Re: (un)aligned accesses on x86 platform. From: Richard Guenther To: =?ISO-8859-2?Q?Pawe=B3_Sikora?= Cc: gcc@gcc.gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2010-03/txt/msg00089.txt.bz2 2010/3/8 Pawe=C5=82 Sikora : > hi, > > during development a cross platform appliacation on x86 workstation > i've enabled an alignemnt checking [1] to catch possible erroneous > code before it appears on client's sparc/arm cpu with sigbus ;) > > it works pretty fine and catches alignment violations but Jakub Jelinek > had told me (on glibc bugzilla) that gcc on x86 can still dereference > an unaligned pointer (except for vector insns). > i suppose it means that gcc can emit e.g. movl for access a short int > (or maybe others scenarios) in some cases and violates cpu alignment rule= s. > > so, is it possible to instruct gcc-x86 to always use suitable loads/stores > like on sparc/arm? Only by re-building it and setting STRICT_ALIGNMENT. Richard. > [1] "AC" bit - http://en.wikipedia.org/wiki/FLAGS_register_(computing) > > BR, > Pawel. >