------- Additional Comments From kenner at vlsi1 dot ultra dot nyu dot edu  
2005-04-07 14:13 -------
Subject: Re:   [4.0/4.1 Regression] Miscompilation with __attribute ((aligned))

    This is caused by the big Ada patch that introduced the extra 2
    ARRAY_REF arguments.  Unfortunately, I couldn't find the reason why is
    the last ARRAY_REF's argument measured in aligment units and not in
    bytes (and what was the reason for adding this argument).

It has to do with the way MEM_ALIGN is computed.  What happens is that
when we compute the address of the MEM, we do it by multiplying the index
by the size in some units.  The second operand of that multiply is the only
way that RTL generation can know what the alignment is.  If the units
were in bytes, the multiplication wouldn't show the alignment.  We have
the same issue with DECL_FIELD_OFFSET.

There most definitely needs to be a better way to do this, but this goes back
years and I haven't found one.

    The element type has TYPE_ALIGN_UNIT 16, but TYPE_SIZE_UNIT 4,

That's wrong.  The size always needs to be a multiple of the alignment.
That's fundamental.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20794

Reply via email to