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: [RFA] Fix bit/byte unit thinko in is_aliasing_offset


    We'd have to check where it's being allocated.  It's easy to support
    this alignment for TREE_STATIC variables, at least for ELF.  For 
    variables on the stack we should be limited to STACK_BOUNDARY or 
    PREFERRED_STACK_BOUNDARY.

But, at least in Ada, if you accept an alignment on a type, you must guarantee
it for *all* objects of that type.

What we do in Ada if you have an alignment larger than STACK_BOUNDARY but
smaller than MAX_OFILE_ALIGNMENT and are allocating a stack object is to make
a RECORD_TYPE whose size is the size of the object plus the alignment (in
bytes). Using a PLACEHOLDER_EXPR, the position of the single field of the
record is computed with an expression that looks at the address of the start
of the record modulo the requested alignment (in bytes) and thus guarantees
the requested alignment.  References to the object are converted to a
COMPONENT_REF of that field in the record.


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