From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5315 invoked by alias); 22 Nov 2006 11:33:00 -0000 Received: (qmail 5289 invoked by alias); 22 Nov 2006 11:32:51 -0000 Date: Wed, 22 Nov 2006 11:33:00 -0000 Message-ID: <20061122113251.5288.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c/29938] [3.4.4/3.4.6/4.1.1] ARM structure pointer alignment problem with optimization In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "bernard dot fouche at kuantic dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-11/txt/msg01938.txt.bz2 ------- Comment #2 from bernard dot fouche at kuantic dot com 2006-11-22 11:32 ------- Subject: Re: [3.4.4/3.4.6/4.1.1] ARM structure pointer alignment problem with optimization rearnsha at gcc dot gnu dot org wrote: > ------- Comment #1 from rearnsha at gcc dot gnu dot org 2006-11-22 10:50 ------- > The compiler expects 'y' to be correctly aligned because the ABI says that it > can expect this to be so. If you write a program that then provides an > unaligned value, then the behaviour is undefined and you can get any result the > compiler feels like giving you. > > Hint: don't increment void* pointers (it's a gcc extension that permits this > anyway) and then try to assign them to a structure. Malloc provides memory > that is correctly aligned for direct assignment to any structure type. > > > Sorry for having taken your time for nothing. I'll read the ABI spec better next time. Too bad my target does not have alignment traps, I've fallen in the problem while building a packet with an odd size header. Regards, Bernard -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29938