This is the mail archive of the 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


On Thu, 7 May 2009, Richard Guenther wrote:

> > Âif (TREE_CODE (exp) == COMPONENT_REF)
> > Â Âsize_tree = TYPE_SIZE (TREE_TYPE (TREE_OPERAND (exp, 1)));
> > Âelse if ...and so on...
> >
> > is wrong, it's DECL_SIZE (TREE_OPERAND (exp, 1)).
> They should be exchangable in the context of an access.

As pointed out, you always should use DECL_SIZE if available.  IMO.


May I say that this whole thing looks rather disturbing, mismatching 
random mixes of different TYPE_ or DECL_SIZEs on the same assignment can't 
be a good sign of a proper intermediate representation.  Except for very 
good reasons, maybe bitfields, but a simple copy from a base variable ...

IMO that variable shouldn't have had a DECL_SIZE that includes alignment ...
I would understand that TYPE_SIZE includes it (and only for the reason 
that constructing arrays of such elements then implicitely includes the 
alignment when going from one to the next member).

>  At least
>   ... = x.a;
> and
>   p = &x.a;
>   ... = *p;
> already have different sizes and that better should not matter(?).

Well, if typeof(*p) has larger alignment (and hence TYPE_SIZE) than 
typeof(x.a) you have a problem when the end of x.a lies exactly on a page 
border for instance, and you want to copy too many bytes.  Weren't there 
even bugreports about exactly such situation?

(Of course *p shouldn't have larger alignment from the start to not 
introduce unaligned accesses, but in that case they also will have the 
same TYPE_SIZEs again, so I stay by my nervousness about mismatching 


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