This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC warnings for unused global variables
On Thu, May 01, 2003 at 08:47:03PM -0700, Geoff Keating 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.
We don't care about side effects to the object if we never
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?
Ok, I'll play your game. By the as-if rule, it *does*
have that value. Any time the program cares to check
that'll be true.
r~