GCC warnings for unused global variables

Paul Koning pkoning@equallogic.com
Fri May 2 13:23:00 GMT 2003


>>>>> "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



More information about the Gcc mailing list