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, pretty-ipa] Fix wave ICE in SRA


Hi,

On Fri, 1 May 2009, Eric Botcazou wrote:

> > Maybe someone can explain the difference between a field DECL_SIZE and its
> > type TYPE_SIZE? 
> 
> The size of a DECL is DECL_SIZE.  For a field, it's not necessarily equal to 
> TYPE_SIZE of its TREE_TYPE, e.g. for bit-fields.  The other cases look more 
> questionable.

The TYPE_SIZE always can contain alignment, which DECL_SIZE doesn't have 
to.  I would think that if DECL_SIZE is existent you should use it.

I think the problem here simply is, that gen_inner_reference is supposed 
to be called only with COMPONENT_REF, ARRAY_{RANGE,}REF or BIT_FIELD_REF.

If you call it with a VAR_DECL (for instance) it will use the ARRAY_REF 
path through the code, which looks at TYPE_SIZE.  I think either you need 
to amend your callers to not pass _DECLs therein, or extend 
get_inner_reference to deal with passed DECL_P objects, ala:

if (DECL_P (exp))
  {
    size_tree = DECL_SIZE (exp);
    mode = DECL_MODE (exp);
    *punsignedp = DECL_UNSIGNED (exp);
  }
else if (TREE_CODE (exp) == COMPONENT_REF)
 ... old code ...


Ciao,
Michael.


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