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]
Other format: [Raw text]

Re: [PATCH][RFC] Define and use middle-end semantics of DECL_BY_REFERENCE


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.


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