This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR44555
Hi,
On Wed, Jun 16, 2010 at 02:33:36PM +0200, Andreas Schwab wrote:
> Richard Guenther <rguenther@suse.de> writes:
>
> > This fixes PR44555 where the C frontend thinks that &a->b
> > evaluates to non-NULL even when b is at offset zero. The
> > patch simply removes that premature optimization from the
> > frontend and leaves it to fold where it is properly
> > implemented (also with the correct targetm.binds_local_p
> > checks, as opposed to the bogus decl_with_nonnull_addr_p
> > in c-common.c).
>
> In which real-world example is this useful, given the undefinedness of
> the operation?
>
In OOP-like C programs, B can be an "ancestor" of A and a function
operating on B-type can call a function operating on A-type without
any extra NULL checks.
Of course, in this particular example it won't matter much since the
front-end does cross function boundaries but e.g. if some of the
"functions" actually happen to be macros...
Martin