From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13650 invoked by alias); 3 Feb 2012 14:23:50 -0000 Received: (qmail 13640 invoked by uid 22791); 3 Feb 2012 14:23:49 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM X-Spam-Check-By: sourceware.org Received: from r-mail2.rd.francetelecom.com (HELO r-mail2.rd.francetelecom.com) (217.108.152.42) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 03 Feb 2012 14:23:36 +0000 Received: from r-mail2.rd.francetelecom.com (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with SMTP id 8EC675D8A00; Fri, 3 Feb 2012 15:23:34 +0100 (CET) Received: from ftrdsmtp1.rd.francetelecom.fr (unknown [10.192.128.46]) by r-mail2.rd.francetelecom.com (Postfix) with ESMTP id 81D705D89FB; Fri, 3 Feb 2012 15:23:34 +0100 (CET) Received: from ftrdmel11.rd.francetelecom.fr ([10.192.128.45]) by ftrdsmtp1.rd.francetelecom.fr with Microsoft SMTPSVC(6.0.3790.4675); Fri, 3 Feb 2012 15:23:34 +0100 Received: from r-lnx-ilmarinen.localnet ([10.194.59.183]) by ftrdmel11.rd.francetelecom.fr with Microsoft SMTPSVC(6.0.3790.4675); Fri, 3 Feb 2012 15:23:33 +0100 From: "Yann E. MORIN" To: crossgcc@sourceware.org Subject: Re: Compiler Memory Alignment Issue Date: Fri, 03 Feb 2012 14:23:00 -0000 User-Agent: KMail/1.13.5 (Linux/3.2.2-ilmarinen-nv; KDE/4.4.5; x86_64; ; ) Cc: Johannes Stezenbach , Bob Dunlop , Richard Koch , Martin Guy References: <201202031421.23553.yann.morin.1998@free.fr> <20120203141359.GA13360@sig21.net> In-Reply-To: <20120203141359.GA13360@sig21.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201202031523.33507.yann.morin.1998@free.fr> 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/msg00037.txt.bz2 Johannes, Richard, Bob, Martin, All, On Friday 03 February 2012 15:13:59 Johannes Stezenbach wrote: > 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 Indeed, but with the same .config (ie the same compiler settings), and the same code, I get a correct result, where Richard does not. Regards, Yann E. MORIN. -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +0/33 662376056 | Software Designer | \ / CAMPAIGN | ^ | | --==< O_o >==-- '------------.-------: X AGAINST | /e\ There is no | | http://ymorin.is-a-geek.org/ | (*_*) | / \ HTML MAIL | """ conspiracy. | '------------------------------'-------'------------------'--------------------' -- For unsubscribe information see http://sourceware.org/lists.html#faq