On 9/9/07, Mark Mitchell <[EMAIL PROTECTED]> wrote: > Richard Guenther wrote: > > On 9/9/07, Mark Mitchell <[EMAIL PROTECTED]> wrote: > >> But, I don't think that even the C meaning is safe in C++ for use with > >> the library declaration of <new>. I'm also somewhat skeptical of the > >> idea that we will never do any optimization on pointer comparisons. > >> What design principle in the compiler is going to keep us from some day > >> introducing the obvious idea that "if modifying *p cannot affect the > >> value of *q, and p and q are of the same type, then p != q"? > > > > But that reasoning is not valid. Consider > > > > void foo(int *q, double *p) > > { > > if (q != p) > > abort (); > > } > > int main() > > { > > int i; > > foo (&i, &i); > > } > > That doesn't type-check; did you want to have a cast somewhere? Note > that my statement above depends on the pointers having the same type. > > What is an example program in that meets the requirements I gave above > -- i.e., allows the compiler to prove that two same-typed pointers do > not alias (whether by the compiler's cleverness, use of "restrict", or > whatever), but where the compiler must still assume that the values of > the pointers might be the same?
I see I misinterpreted your sentence. I don't think a testcase that holds all your requirements can be constructed as they contradict each other. Can you give one? Richard.