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] mips: Allow larger values for __aligned__

Hans-Peter Nilsson <> writes:

> On Thu, 20 Sep 2006, Ian Lance Taylor wrote:
> > I suspect the right patch is going to be putting something like this
> > in elfos.h:
> >
> > #ifdef HOST_BITS_PER_WIDEST_INT >= 64
> > #define MAX_OFILE_ALIGNMENT (((unsigned HOST_WIDEST_INT) 1 << 31) * 8)
> > #else
> > #define MAX_OFILE_ALIGNMENT (((unsigned HOST_WIDEST_INT) 1 << 28) * 8)
> > #endif
> *HOST*_BITS_... controlling the *target* MAX_OFILE_ALIGNMENT?
> Use max target pointer size instead?

Clearly HOST_BITS should not control MAX_OFILE_ALIGNMENT, but the
problem is that currently the number needs to be representable on the
host.  MAX_OFILE_ALIGNMENT is measured in bits, so the correct value
is 0x800000000, and that number is not representable if

I suppose a fully correct fix would be to change the recorded
alignment to use an INTEGER_CST rather than an unsigned int.  But that
is a somewhat tedious change, and it's extremely unusual for somebody
to want to align a value to an address which does not fit in an int.
So I think my suggested patch is good enough.

Actually a better change would be to store alignment as the power to
which 2 is raised rather than as the power of 2 itself.  Then we can
represent any currently conceivable alignment using unsigned int.


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