delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2007/04/18/11:32:38

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Rod Pemberton" <do_not_have AT bitfoad DOT cmm>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: gcc bug?
Date: Tue, 17 Apr 2007 09:39:25 -0400
Organization: Aioe.org NNTP Server
Lines: 43
Message-ID: <f02im5$a6s$1@aioe.org>
References: <LbadnVsa3_H-ornbnZ2dnUVZ_sudnZ2d AT comcast DOT com> <f01r0r$59u$1 AT aioe DOT org> <G-CdnfEDh5KKDLnbnZ2dnUVZ_jydnZ2d AT comcast DOT com>
NNTP-Posting-Host: IVw7K97ih4IohxRqyKkqFw.user.aioe.org
X-Complaints-To: abuse AT aioe DOT org
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
X-Priority: 3
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MSMail-Priority: Normal
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Alexei A. Frounze" <alexfru AT chat DOT ru> wrote in message
news:G-CdnfEDh5KKDLnbnZ2dnUVZ_jydnZ2d AT comcast DOT com...
> Rod Pemberton wrote:
> > "Alexei A. Frounze" <alexfru AT chat DOT ru> wrote in message
> > news:LbadnVsa3_H-ornbnZ2dnUVZ_sudnZ2d AT comcast DOT com...

Very sleepy now on a topic I'm not well versed on...  This, from n1124
6.7.3, as I read it, seems to apply. (e.g., both the data _and_ pointer need
a volatile...)

"5 If an attempt is made to modify an object defined with a const-qualified
type through use
of an lvalue with non-const-qualified type, the behavior is undefined. If an
attempt is
made to refer to an object defined with a volatile-qualified type through
use of an lvalue
with non-volatile-qualified type, the behavior is undefined.113)"


Anyway, let's ignore the spec. and see if I've got it the issues straight:

Volatile on the pointer works (i.e., f2).  If the pointer is volatile, then
the data is volatile implicitly (i.e., new pointer therefore new data).
And, both optimized and unoptimized, we see the pointer being reloaded from
the stack and the data being reloaded from the pointer.

Volatile on the data doesn't work (i.e., f1) supposedly just for -O2.  If
the pointer isn't volatile, but the data is, then just the data should be
reloaded.  Unoptimized, the compiler treats both as volatile (both are
refreshed), i.e., incorrect.  Optimized, the compiler treats both as
non-volatile (neither are reloaded), i.e, (appears) incorrect.  So,
technically, both are incorrect.  But, for the unoptimized case, since the
pointer isn't changing, it's functionally correct.  For the optimized case,
it would appear that it's incorrect unless the compiler can somehow
determine that the data isn't changing...

Going to sleep...


Rod Pemberton


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019