From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6544 invoked by alias); 16 Jul 2005 17:32:11 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 6537 invoked by uid 22791); 16 Jul 2005 17:32:09 -0000 Received: from h-68-164-203-246.nycmny83.covad.net (HELO dberlin.org) (68.164.203.246) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Sat, 16 Jul 2005 17:32:09 +0000 Received: from [127.0.0.1] (HELO dberlin.org) by dberlin.org (CommuniGate Pro SMTP 4.3.4) with ESMTPS id 8208787; Sat, 16 Jul 2005 13:32:07 -0400 Date: Sat, 16 Jul 2005 17:32:00 -0000 From: Daniel Berlin To: Nathan Sidwell cc: "D. Hugh Redelmeier" , gcc@gcc.gnu.org, Dale Johannesen , Mike Stump Subject: Re: volatile semantics In-Reply-To: <42D94324.2090503@codesourcery.com> Message-ID: References: <851D2CB0-93DF-4C49-A6A8-8895DB1A08F9@apple.com> <42778D99.7070904@codesourcery.com> <1121532997.29893.6.camel@linux.site> <42D94324.2090503@codesourcery.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-SW-Source: 2005-07/txt/msg00667.txt.bz2 >> object volatile). > > I don't understand your point. given > void Foo (char const * a) { *(char *)a = 5; } > the compiler generates code to store 5 through the pointer 'a'. It doesn't turn > this into a call to 'abort', because it thinks you're writing to const storage. Is this *always* the cast, or just in the example above? > > So, here it appears the compiler does believe the (char *) cast. I imagine this is due to some workaround in an optimizer for some bug it exposed elswhere. > Why should it > not believe a (char volatile *) cast -- unless it can determine the static type > of the object pointed to? It appears he was saying that *even if it could determine the static type*, the volatile qualifier on the cast *made the object not that type anymore*. And i'm not sure why such a thing would apply only to volatile, if true. --Dan