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


>>>>> "Richard" == Richard Henderson <rth@redhat.com> writes:

 Richard> On Thu, May 01, 2003 at 08:47:03PM -0700, Geoff Keating
 Richard> wrote:
 >> The C standard says:
 >> 
 >> > An object that has volatile-qualified type may be modified in
 >> ways > unknown to the implementation or have other unknown side
 >> effects.
 >> 
 >> That sounds exactly like a description of the case here: the
 >> 'unknown side effect' is that what(1) reads the string.

 Richard> We don't care about side effects to the object if we never
 Richard> access it.  You're reading that *way* too far afield.

 >> For instance, at program startup (in this case) the abstract
 >> machine says the string contains a particular value, and how can
 >> it do that if it is optimized away?

 Richard> Ok, I'll play your game.  By the as-if rule, it *does* have
 Richard> that value.  Any time the program cares to check that'll be
 Richard> true.

But the purpose of "volatile" is to make it true not just for the
program, but also for things outside the program.

	 paul


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