This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Null pointer check elimination
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: gdr at integrable-solutions dot net (Gabriel Dos Reis)
- Cc: paul at codesourcery dot com (Paul Brook), gcc at gcc dot gnu dot org, per at bothner dot com (Per Bothner), green at redhat dot com (Anthony Green), java at gcc dot gnu dot org
- Date: Sat, 12 Nov 2005 16:01:07 -0500 (EST)
- Subject: Re: Null pointer check elimination
>
> Paul Brook <paul@codesourcery.com> writes:
>
> | On Saturday 12 November 2005 18:32, Gabriel Dos Reis wrote:
> | > Per Bothner <per@bothner.com> writes:
> | > | 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.
> | >
> | > We already have such mechanism: a reference type
> |
> | No. We've had this discussion before, and the conclusion what that reference
> | types can be NULL.
> |
> | http://gcc.gnu.org/ml/gcc-patches/2004-08/msg01463.html
>
> That simply means GCC got it wrong.
Was there an example of:
int f(int &);
int g(void)
{
int *a = 0;
return f(*a);
}
Yes this would be undefined code but so what.
-- Pinski