[PATCH] DATA_ALIGNMENT vs. DATA_ABI_ALIGNMENT (PR target/56564)

Alan Modra amodra@gmail.com
Thu Jun 13 22:48:00 GMT 2013


On Thu, Jun 13, 2013 at 05:42:17PM +0200, Jakub Jelinek wrote:
> On Fri, Jun 14, 2013 at 01:07:01AM +0930, Alan Modra wrote:
> > @@ -5774,10 +5818,11 @@ offsettable_ok_by_alignment (rtx op, HOST_WIDE_INT
> >        type = TREE_TYPE (decl);
> >  
> >        dalign = TYPE_ALIGN (type);
> > +      dalign = DATA_ABI_ALIGNMENT (type, dalign);
> >        if (CONSTANT_CLASS_P (decl))
> >  	dalign = CONSTANT_ALIGNMENT (decl, dalign);
> >        else
> > -	dalign = DATA_ALIGNMENT (decl, dalign);
> > +	dalign = DATA_ALIGNMENT (type, dalign);
> >  
> >        if (dsize == 0)
> >  	{
> 
> What is this code trying to do?  Shouldn't it just use DECL_ALIGN
> which should be set to the right value from get_variable_alignment?
> I mean, if !decl_binds_to_current_def_p (decl), then using DATA_ALIGNMENT
> or CONSTANT_ALIGNMENT (for anything but actually emitting the var into
> object, or just as an optimization hint that very likely the decl will be
> aligned enough, but not guaranteed), which are optimization, is wrong
> (an ABI problem).

It is handling !DECL_P trees, which must be local.  I know I saw
STRING_CST here when I wrote offsettable_ok_by_alignment, hence the
use of CONSTANT_ALIGNMENT.  I'm not so sure about the need for
DATA_ALIGNMENT now, but if it was correct before then we ought to
be using both DATA_ABI_ALIGNMENT and DATA_ALIGNMENT after your
changes.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Gcc-patches mailing list