This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, pretty-ipa] Fix wave ICE in SRA
- From: Michael Matz <matz at suse dot de>
- To: Martin Jambor <mjambor at suse dot cz>
- Cc: Eric Botcazou <ebotcazou at adacore dot com>, Richard Guenther <richard dot guenther at gmail dot com>, gcc-patches at gcc dot gnu dot org, Jan Hubicka <hubicka at ucw dot cz>
- Date: Fri, 1 May 2009 23:48:15 +0200 (CEST)
- Subject: Re: [PATCH, pretty-ipa] Fix wave ICE in SRA
- References: <20090429121643.GC4633@virgil.suse.cz> <20090430150745.GA5129@alvy.suse.cz> <84fc9c000905011324k4e891419y9e5c7d5591d1978d@mail.gmail.com> <200905012332.49252.ebotcazou@adacore.com>
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.