Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Wed, 26 Feb 2003 15:48:07 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Wed, 26 Feb 2003 15:48:07 -0500 Received: from crack.them.org ([65.125.64.184]:22952 "EHLO crack.them.org") by vger.kernel.org with ESMTP id ; Wed, 26 Feb 2003 15:48:04 -0500 Date: Wed, 26 Feb 2003 15:57:54 -0500 From: Daniel Jacobowitz To: Horst von Brand Cc: Falk Hueffner , jt@hpl.hp.com, Linux Kernel Mailing List Subject: Re: Invalid compilation without -fno-strict-aliasing Message-ID: <20030226205754.GA29466@nevyn.them.org> Mail-Followup-To: Horst von Brand , Falk Hueffner , jt@hpl.hp.com, Linux Kernel Mailing List References: <873cmbghai.fsf@student.uni-tuebingen.de> <200302262047.h1QKlm0P001784@eeyore.valparaiso.cl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200302262047.h1QKlm0P001784@eeyore.valparaiso.cl> User-Agent: Mutt/1.5.1i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1567 Lines: 41 On Wed, Feb 26, 2003 at 05:47:48PM -0300, Horst von Brand wrote: > Falk Hueffner said: > > Horst von Brand writes: > > > Jean Tourrilhes said: > > > > if((stream + event_len) < ends) { > > > > iwe->len = event_len; > > > > memcpy(stream, (char *) iwe, event_len); > > > > stream += event_len; > > > > } > > > > return stream; > > > > } > > > > > > The compiler is free to assume char *stream and struct iw_event *iwe > > > point to separate areas of memory, due to strict aliasing. > > > > The relevant paragraph of the C99 standard is: > > > > An object shall have its stored value accessed only by an lvalue > > expression that has one of the following types: > [...] > > -- a character type. > > (char *) gives you a (pointer to) a character type. > > > I can't really spot any lvalue here that might violate this rule. It > > would be nice if somebody could report a bug with a testcase. > > stream and (char *) iwe Stream is not the same storage as iwe, so this is hardly the issue. Writes to stream don't affect iwe. The problem was the assignment to iwe->len being moved after the access, according to the report. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/