Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!uxc!tank!shamash!com50!jhereg!mark From: mark@jhereg.Jhereg.MN.ORG (Mark H. Colburn) Newsgroups: gnu.gcc.bug Subject: Re: the idea of a new feature for gcc Message-ID: <878@jhereg.Jhereg.MN.ORG> Date: 12 May 89 14:57:28 GMT References: <8905111829.AA18182@decwrl.dec.com> Reply-To: mark@jhereg.MN.ORG (Mark H. Colburn) Distribution: gnu Organization: Minnetech Consulting, Inc., St. Paul, MN Lines: 28 In article <8905111829.AA18182@decwrl.dec.com> skubi%decprl.DEC@DECWRL.DEC.COM writes: >Gnu C should differentiate between ordinary RAM cells and hardware registers >mapped into (virtual or not) memory. > >Examples: > > /* the example above, modified */ > hardware long int adr*; > do { > res_brut = *adr; > } while (res_brut & 0x60000); The example that you gave is precisely the reason that the ANSI X3J11 commitee added the "volatile" keyword. Volatile is to be used when the compiler should not optimize away variable references since they may be required to latch devices, or to read constantly changing memory. I think that if you change your example above to read: volatile long int *adr; do { res_brut = *adr; } while (res_brut & 0x60000); You will get the results that you want. -- Mark H. Colburn mark@jhereg.mn.org Minnetech Consulting, Inc.