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 live with that. My problem was that the addresses cannot
be correct. In my opinion, the undefined behavior should be
limited to the value in the address or in some form of error.
But to let the buggy code execute with addresses that are not
accurate is a liberty I would hope could have been avoided. It
just looks bad. I do realize, no one should have a gripe, because
the code is buggy to begin with. But addresses should always be
reported accurately IMHO. Of course, I obviously know nothing
about compilers. (smiles ;)

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

Reply via email to