This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC warnings for unused global variables


On Fri, May 02, 2003 at 09:42:23AM -0700, Joe Buck wrote:
> On Fri, May 02, 2003 at 06:00:30PM +0200, Gabriel Dos Reis wrote:
> > | Because, since the object is volatile, it may affect the program in
> > | ways unknown to the compiler.
> > 
> > This is my favorite peeve against the definition of "volatile".
> > Does an alpha ray fired from Centauri count as a "way unknown to the
> > compiler"?
> 
> This is a much better example than you thought it was.  The answer is
> "yes".  Alpha particles are a major source of soft errors; they can
> spontaneously change the value that is stored in RAM.  Duplicated
> reads can't be eliminated because they might miss the change caused
> by the alpha particle.  A memory test might be written in C with
> a big volatile array, and one of the things it would be looking for
> is effects caused by alpha particles.
> 
> (Of course, an alpha particle can't make it through the atmosphere,
> so you'll need to pick some other particle or photon type).

Or put the platform outside the atmosphere.  These kinds of errors are
a headache for some of my colleagues.  Yes, they happen.  Yes, they use
volatile.

-- 
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace.  We seek
not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen.            - Samuel Adams


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]