This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: proposed patch for gcse.c (delete_null_pointer_checks)


  In message <199910281544.LAA29449@curly.cs.duke.edu>you write:
  > >   > This patch also deduces this for small offsets such as "p[1]".
  > > I'm not sure that is a wise thing to do.  Dereferencing a null
  > > pointer is an absolute naughty thing to do according to ANSI/ISO.
  > > No other pointer value has that property that I'm aware of.
  > 
  > The draft C9X lists additional "invalid values for dereferencing",
  > and indicates there may be additional implementation-defined ones.
  > It also says "Such a pointer, called a null pointer, is guaranteed
  > to compare unequal to a pointer to any object or function."
  > I believe it is reasonable to infer that dereferencing a
  > null pointer "p" is invalid whether done with p[0] or p[1] or p->x
  > since none of these can be an object or function.
I've already stated twice that from a language standpoint I agree with you.

But given the way our RTL representation works, I do not believe this
optimization is safe.  For further details see my previous message to 
Richard Henderson.

jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]