Re: GNU C keyword volatile, GNU compiler/optimizer and instruction re-ordering

thp@cs.ucr.edu
18 Oct 2002 23:42:54 -0400

          From comp.compilers

Related articles
GNU C keyword volatile, GNU compiler/optimizer and instruction re-or Arun@Winphoria.Com (Arun) (2002-09-19)
Re: GNU C keyword volatile, GNU compiler/optimizer and instruction nmm1@cus.cam.ac.uk (Nick Maclaren) (2002-09-20)
Re: GNU C keyword volatile, GNU compiler/optimizer and instruction re- mrs@kithrup.com (Mike Stump) (2002-09-29)
Re: GNU C keyword volatile, GNU compiler/optimizer and instruction re- fjh@cs.mu.OZ.AU (Fergus Henderson) (2002-10-13)
Re: GNU C keyword volatile, GNU compiler/optimizer and instruction r nmm1@cus.cam.ac.uk (Nick Maclaren) (2002-10-13)
Re: GNU C keyword volatile, GNU compiler/optimizer and instruction re- thp@cs.ucr.edu (2002-10-18)
| List of all articles for this month |

From: thp@cs.ucr.edu
Newsgroups: comp.compilers
Date: 18 Oct 2002 23:42:54 -0400
Organization: University of California, Riverside
References: 02-09-118 02-09-122 02-09-170 02-10-008
Keywords: C, standards
Posted-Date: 18 Oct 2002 23:42:54 EDT

Nick Maclaren <nmm1@cus.cam.ac.uk> wrote:
+ Mike Stump <mrs@kithrup.com> wrote:
+>Nick Maclaren <nmm1@cus.cam.ac.uk> wrote:
+>>Unfortunately, volatile is a complete mess.
+>
+>I think this statement is overly pessimistic. I disagree entirely
+>with this assessment of volatile. I think it is clear what it means,
+>and it is useful. I think the C++ standard clarifies some points for
+>users that might not otherwise know what it means. I think it would
+>be possible to write down exactly what it means and add this to the
+>language standards, but such an undertaking absolutely must be done by
+>people that know what it means. The C++ standard almost got into
+>serious trouble trying to refine and fix volatile. Unfortunately all
+>the right people to do this weren't available to do the right job.
+>Fortunately disaster was averted.


+ Hmm. Well, having been an active member of the BSI C Panel during
+ both the C90 and C99 public comment periods, I can tell you that the
+ working group did not agree with what it should mean, let alone
+ whether the wording made this clear.


+ If you are serious, then I suggest that you write a clear description
+ in standardese and submit it to the working group. Plenty of people
+ on that have tried doing what you say, and so far failed.


The problems get very troublesome. Can a conforming implementation
include a debugger that lets me modify both volatile and non-volatile
variables? What if I only modify volatiles ones? Exactly when is a
register-resident copy of a volatile variable fresh enough? What's
meant by a sequence point? What does it mean to be before or after a
sequence point? I can go on.


That said, I agree with Mike that a clear writeup of these notions iss
both doable and important. (I just know that I find it difficult.) I
would propose that a first project would be to write a very clear
explanation of these concepts in prose that is common to mathematics
and theoretical computer science. When that is in satisfactory shape,
then translate it into standardese.


Tom Payne


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.