This is the mail archive of the gcc@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: f/target.c HOST_BYTES_BIG_ENDIAN


On Fri, 23 Aug 2002, Alan Modra wrote:

> On Thu, Aug 22, 2002 at 09:33:58AM -0400, Hans-Peter Nilsson wrote:
> > On Thu, 22 Aug 2002, Alan Modra wrote:
> >
> > > HOST_BYTES_BIG_ENDIAN and HOST_BITS_BIG_ENDIAN are referenced in
> > > f/target.c when cross-compiling, but are not defined anywhere.
> >
> > That sounds strange (for a BE host).  f/target.c does include
> > config.h which includes auto-host.h...
>
> HOST_WORDS_BIG_ENDIAN is the only HOST_*_BIG_ENDIAN macro defined.
> grep the source.

Bummer.  I added tests for macros that are not there.  So only a
subset of the host <=> target mismatch situation is detectable:
HOST_WORDS_BIG_ENDIAN <=> BYTES_BIG_ENDIAN.  The semantics for
the host vs. target macros are a little different;
HOST_WORDS_BIG_ENDIAN implies the hostness *BYTES*_BIG_ENDIAN
but also the host *WORDS*_BIG_ENDIAN.  And apparently nothing
else has a need to test these host endian details so it doesn't
seem worthwhile to actually autoconf for it.  Ugh.

Your patch is wrong; don't use the *target* BITS_BIG_ENDIAN (et
al) when the HOST_ one isn't defined.  I suggest to remove that
test; check instead that HOST_WORDS_BIG_ENDIAN matches both
BYTES_BIG_ENDIAN and WORDS_BIG_ENDIAN.  I see there's also a
HOST_FLOAT_WORDS_BIG_ENDIAN FWIW.

(Heh, it seems few people use big-endian hosts for
cross-compiling fortran.)

> >  There doesn't seem to be
> > anything magic about NATIVE_CROSS.  What am I missing?
>
> Belts and braces.  Strictly speaking, it's not necessary with the
> other changes.

Well it's confusing.  I think there should be no NATIVE_CROSS
test.  (Actually it's the wrong direction of the belts and
braces; belts and braces would have been to remove the #ifdef
CROSS_COMPILE and *always* test for endian mismatch. ;-)

brgds, H-P


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