This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: DATA_ALIGNMENT vs. DECL_USER_ALIGNMENT
- From: Ulrich Weigand <weigand at immd1 dot informatik dot uni-erlangen dot de>
- To: rth at redhat dot com (Richard Henderson)
- Cc: weigand at immd1 dot informatik dot uni-erlangen dot de (Ulrich Weigand), gcc at gcc dot gnu dot org
- Date: Thu, 10 Apr 2003 02:40:09 +0200 (MET DST)
- Subject: Re: DATA_ALIGNMENT vs. DECL_USER_ALIGNMENT
Richard Henderson wrote:
> I think I'd prefer that we somehow generate an error for
> alignments that cannot be supported (for some definition
> of cannot; I have trouble understanding why labels can't
> be byte aligned on a byte-addressable machine).
The problem is the LOAD ADDRESS RELATIVE LONG instruction
which is used to load the address of a label into a register;
this instruction can only load even addresses. This is
somewhat reasonable as *code* must always be 2-byte aligned
anyway on s390 or execution will trap.
For data labels, it would of course be possible to use
some other means to load the address (e.g. from the literal
pool); however as the backend has no way to find out for
which labels this would be necessary, the alternative
would mean not to use LARL for any label.
We've decided to simply force 2-byte alignment for all
data labels as well (which can't really hurt anyone),
and then be able to use LARL for all labels.
> As is clear from the Irix problem you quote, the user
> might have some real need for a particular alignment,
> and forcing something on them may break things. At least
> this way we'll fail to compile instead of DTWT.
If we want an error message, the safest place to generate
that would probably be the linker (it gets a R_390_PC32DBL
relocation to an odd address, which cannot be correct).
But this does not solve my problem that Ada does not
bootstrap; for some reason the Ada frontend sets the
USER_ALIGN flag for a huge number of variables, even
those that were defined without any special 'Alignment
attributes ...
Bye,
Ulrich
--
Dr. Ulrich Weigand
weigand at informatik dot uni-erlangen dot de