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]

f/target.c HOST_BYTES_BIG_ENDIAN


HOST_BYTES_BIG_ENDIAN and HOST_BITS_BIG_ENDIAN are referenced in
f/target.c when cross-compiling, but are not defined anywhere.
This makes g77 spit the dummy when cross-compiling from a
big-endian host to a big-endian target.

Since arbitrarily assuming host bytes and bits are little endian is
arguably worse than assuming host and target match, may I suggest
the following patch?

gcc/f/ChangeLog
	* target.c (ffetarget_memcpy_): Don't test endian macros when
	NATIVE_CROSS.  Default host endian values to target values.

Index: gcc/f/target.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/f/target.c,v
retrieving revision 1.19
diff -u -p -r1.19 target.c
--- gcc/f/target.c	17 Jun 2002 21:21:01 -0000	1.19
+++ gcc/f/target.c	22 Aug 2002 12:04:18 -0000
@@ -2520,10 +2520,10 @@ ffetarget_verify_character1 (mallocPool 
 void *
 ffetarget_memcpy_ (void *dst, void *src, size_t len)
 {
-#ifdef CROSS_COMPILE
+#if defined (CROSS_COMPILE) && !defined (NATIVE_CROSS)
   int host_words_big_endian =
 #ifndef HOST_WORDS_BIG_ENDIAN
-    0
+    WORDS_BIG_ENDIAN
 #else
     HOST_WORDS_BIG_ENDIAN
 #endif
@@ -2531,7 +2531,7 @@ ffetarget_memcpy_ (void *dst, void *src,
 
   int host_bytes_big_endian =
 #ifndef HOST_BYTES_BIG_ENDIAN
-    0
+    BYTES_BIG_ENDIAN
 #else
     HOST_BYTES_BIG_ENDIAN
 #endif
@@ -2539,7 +2539,7 @@ ffetarget_memcpy_ (void *dst, void *src,
 
   int host_bits_big_endian =
 #ifndef HOST_BITS_BIG_ENDIAN
-    0
+    BITS_BIG_ENDIAN
 #else
     HOST_BITS_BIG_ENDIAN
 #endif

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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