Re: module level flags
Bruce Korb <bkorb <at> pacbell.net>
2002-10-01 03:54:37 GMT
Alexandre Oliva wrote:
> On Sep 29, 2002, Bruce Korb <bkorb <at> pacbell.net> wrote:
> > In this case, the issue is that the aliasing analysis is incomplete.
> > If a routine contains explicit code to cast the address of an object
> > of type 'a' to pointers to type b, then in the context of that
> > routine it is reasonable to presume a '*b' can refer an object 'a'.
> > They are equivalent.
> Now what if you factor the code that uses *b into a separate function?
You have that problem with "void*" aliasing or any other kind of
aliasing. Some you are required to guard against (assume aliasing),
some not. My claim is that ANSI ought to have considered intptr_t
as being potentially aliased by arbitrary pointers, _exactly_ the
same way void* values are treated. And, my argument went on, if
you aren't going to support "obvious" cases such as this, then you
should support hard errors on obvious cases. It is clear you cannot
warn about all potential cases.
> All of a sudden, the code stops working because within that separate
> function it is not known that *b may alias an object of type stumble?
So, to protect users from this catastrophe, you silently destroy
the efficacy of a pointer causing their programs to head south
without a discernible error or even a warning. Phooey. It is true
you can stretch stuff into improbable cases whereby you cannot
effectively warn; you cannot detect the aliasing; and you wind up
with a bug. That's not a sufficient excuse for throwing up your