This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Null pointer check elimination
- From: Diego Novillo <dnovillo at redhat dot com>
- To: gcc at gcc dot gnu dot org
- Cc: Per Bothner <per at bothner dot com>, Anthony Green <green at redhat dot com>, java at gcc dot gnu dot org
- Date: Sat, 12 Nov 2005 12:16:00 -0500
- Subject: Re: Null pointer check elimination
- References: <1131747852.3205.105.camel@localhost.localdomain> <1131813488.7465.140.camel@linux.site> <437620D9.9090701@bothner.com>
On Saturday 12 November 2005 12:05, Per Bothner wrote:
> A "function-never-returns-null" attribute doesn't seem like
> the right mechanism. Instead, there should be a "never-null"
> attribute on pointer types. A "function-never-returns-null" is
> just a function whose return-type has the "never-null" attribute.
>
I disagree. We would have to prove that every possible instance of this
type is non-NULL.
> A type attribute is much more useful. For example it allows:
> String x = shared ? "x" : new String("x");
> // The type of x [in a single-assignment-world] is non-null.
>
No. We don't put our types in SSA form. Another variable of type String
could very well be NULL.