public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* f/target.c HOST_BYTES_BIG_ENDIAN
@ 2002-08-22  5:16 Alan Modra
  2002-08-22  6:34 ` Hans-Peter Nilsson
  0 siblings, 1 reply; 8+ messages in thread
From: Alan Modra @ 2002-08-22  5:16 UTC (permalink / raw)
  To: gcc, gcc-patches; +Cc: Hans-Peter Nilsson

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-08-23 20:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-22  5:16 f/target.c HOST_BYTES_BIG_ENDIAN Alan Modra
2002-08-22  6:34 ` Hans-Peter Nilsson
2002-08-22 16:22   ` Alan Modra
2002-08-22 19:32     ` Hans-Peter Nilsson
2002-08-22 20:31       ` Alan Modra
2002-08-23 13:42         ` Hans-Peter Nilsson
2002-08-23 20:27           ` Alan Modra
2002-08-23 13:19       ` Toon Moene

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).