On Tue, Jun 17, 2008 at 11:01:31AM -0700, Ian Lance Taylor wrote:
> > ~~~~~~~~~~~~~~~~ output ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > $ const_ints 
> > const int ic = 0   *cip = 5   *ip = 5
> > &ic = 0xbfbd72a0    cip = 0xbfbd72a0    ip = 0xbfbd72a0
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > The global variable code would segfault, as I expected. But the
> > auto variable code gives this illogical result. I would appreciate
> > comments. I am not on this list, so please ensure I am cc'd with
> > any responses. I'll be happy to file a bug, if it is a bug.
> 
> Modifying a variable which is declared const is undefined behaviour.
> You can not predict what happens.
> 
> Ian
Hi Ian,
I can appreciate that. My point was the addresses are not valid
here. In my opinion, it seems reasonable to limit the undefined
behavior to the value of the variable, or to some form of
failure and error, up to and including crashing the process.
But to implement the code in such a way to let the process
proceed without error, and to have incorrect addresses as we
see here, seems to be beyond the common sense scope of the bounds
of what this assignment's undefined behavior potential effects
might be. It is interesting. Thank you for your comment.

Thanks,
Karen
-- 
 Karen Shaeffer
 Neuralscape, Palo Alto, Ca. 94306
 [EMAIL PROTECTED]  http://www.neuralscape.com

Reply via email to