From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22576 invoked by alias); 3 Feb 2012 15:13:13 -0000 Received: (qmail 22560 invoked by uid 22791); 3 Feb 2012 15:13:12 -0000 X-SWARE-Spam-Status: No, hits=0.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,TW_QE,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from snt0-omc3-s50.snt0.hotmail.com (HELO snt0-omc3-s50.snt0.hotmail.com) (65.54.51.87) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 03 Feb 2012 15:12:58 +0000 Received: from SNT112-W30 ([65.55.90.136]) by snt0-omc3-s50.snt0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 3 Feb 2012 07:12:56 -0800 Message-ID: From: Richard Koch To: Subject: RE: Compiler Memory Alignment Issue Date: Fri, 03 Feb 2012 15:13:00 -0000 In-Reply-To: <20120203141359.GA13360@sig21.net> References: ,<20120203101627.GA13646@xyzzy.org.uk>,<201202031421.23553.yann.morin.1998@free.fr>,<20120203141359.GA13360@sig21.net> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact crossgcc-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: crossgcc-owner@sourceware.org X-SW-Source: 2012-02/txt/msg00038.txt.bz2 Yann, Johannes, Bob, Martin, All, Thank you for all your information. I have updated to C-compiler 4.4.4 and am no longer seeing the alignment issue. I have also tried the suggestion to update /proc/cpu/alignment and that works as well with the older compiler. I will point out to the developers in my group to try to use "compliant" coding methods when casting between types. Thanks again. -Rick Koch ---------------------------------------- > Date: Fri, 3 Feb 2012 15:13:59 +0100 > From: js@sig21.net > To: yann.morin.1998@free.fr > CC: crossgcc@sourceware.org; bob.dunlop@xyzzy.org.uk; n1gp@hotmail.com; m= artinwguy@gmail.com > Subject: Re: Compiler Memory Alignment Issue > > Hi Yann, > > On Fri, Feb 03, 2012 at 02:21:23PM +0100, Yann E. MORIN wrote: > > On Friday 03 February 2012 11:16:27 Bob Dunlop wrote: > > > On Thu, Feb 02 at 01:15, Richard Koch wrote: > > > > I'm seeing an alignment issue when I'm incrementing a pointer. > > > > I Just tried your .config and your sample C code, and it seems to work = here > > (with the buffer overflow fixed): > > As Martin Guy pointed out the issue may be caused > by wrong alignment. In fact the behaviour of the code > is undefined according to C99 if buffer is not suitably aligned: > https://www.securecoding.cert.org/confluence/display/seccode/EXP36-C.+Do+= not+convert+pointers+into+more+strictly+aligned+pointer+types > > I'd suggest to add a printf for the buffer address. > > For ARM, unaligned access is supported for ARMv6+, in ARMv5 > unaligned write is UNPREDICTABLE (unaligned read is > defined as rotated read from aligned address). > Not sure what's the default CPU for qemu-arm but > Richard has ARMv5. I know Linux on ARM926EJ-S can > fix it up in sw like Martin described, but I'm not > sure every ARMv5 CPU supports alignment trap. > > > Johannes =20=09=09=20=09=20=20=20=09=09=20=20 -- For unsubscribe information see http://sourceware.org/lists.html#faq