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: Removal of useless null pointer checks



  In message <37E76FD9.56F681E9@PaceMicro.com>you write:
  > The machine might not have an MMU, or any other means of causing a fault.
But you've triggered undefined behavior in a hosted environment.  Hmm, in
a non-hosted (aka freestanding) environment it may be reasonable to have things
at address zero.

  > Some unfortunate machines require writeable memory or have I/O at
  > or very near address zero.
Yes.  Very near doesn't count :-)  The only address that matters is zero.
This optimization will not consider (mem (plus (reg X) (const_int)) as
defining X to have a nonzero value.

However, I believe it is legitimate to reference address zero in a non-hosted
environment.  So we'll need to make this optimization configurable by the
front-end.  I was planning to do that anyway based on some conversations I
had with the Java folks a few months back. 


  > I guess this optimisation won't cause as much grief as the
  > strict-aliasing stuff...
  > Linux kernel traps null pointers, yes ?
You'll get an oops.  Don't ask me how I know :-)

jeff


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