This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][RFC] Define and use middle-end semantics of DECL_BY_REFERENCE
- From: Michael Matz <matz at suse dot de>
- To: Richard Guenther <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 27 Jul 2009 16:39:03 +0200 (CEST)
- Subject: Re: [PATCH][RFC] Define and use middle-end semantics of DECL_BY_REFERENCE
- References: <alpine.LNX.2.00.0907271554310.16347@zhemvz.fhfr.qr>
Hi,
On Mon, 27 Jul 2009, Richard Guenther wrote:
> The middle-end with this patch assumes that all PARM_DECLs that have
> DECL_BY_REFERENCE set point to an object of the pointed-to type
> (not some other type and not some larger or smaller object).
Just some clarification, the assumption is not that the pointer doesn't
point inside some larger object or the like, but rather, that all accesses
through such parameter are type-correct and don't go over declared bounds,
e.g. (pseudo code):
define f (ref to int x)
{ ... body ... }
define array[int] a;
call f(a[3]);
here, the implicit pointer given to f() might point into the object 'a',
or it might not depending on language semantics. But the assumption in
both cases is that f() can not access anything outside a[3] (or an int
temporary) via this parameter, and not in some random other type. Same
for substructures.
I.e. this basically boils down to the frontend not doing fancy pointer
arithmetics on pointers resulting from DECL_BY_REFERENCE PARM_DECLs.
Ciao,
Michael.