From adb563c47117279e1e7ac1c538c80b219ac27312 Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Mon, 8 Apr 2002 22:20:39 +0000 Subject: [PATCH] Make-lang.in (f/target.o): Depend on diagnostic.h. * Make-lang.in (f/target.o): Depend on diagnostic.h. * target.c: Include diagnostic.h. (ffetarget_memcpy_): Call sorry if host and target endians are not matching. From-SVN: r52043 --- gcc/f/ChangeLog | 7 +++++++ gcc/f/Make-lang.in | 4 ++-- gcc/f/target.c | 44 +++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index d522ff853b4..2e42fa58c7d 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,10 @@ +2002-04-08 Hans-Peter Nilsson + + * Make-lang.in (f/target.o): Depend on diagnostic.h. + * target.c: Include diagnostic.h. + (ffetarget_memcpy_): Call sorry if host and target endians are + not matching. + Thu Apr 4 23:29:48 2002 Neil Booth * com.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Redefine. diff --git a/gcc/f/Make-lang.in b/gcc/f/Make-lang.in index f9744d7ed15..d2daf347e20 100644 --- a/gcc/f/Make-lang.in +++ b/gcc/f/Make-lang.in @@ -1,5 +1,5 @@ # Top level makefile fragment for GNU Fortran. -*-makefile-*- -# Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc. +# Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. #This file is part of GNU Fortran. @@ -513,7 +513,7 @@ f/symbol.o: f/symbol.c f/proj.h $(CONFIG_H) $(SYSTEM_H) f/symbol.h \ f/global.h f/name.h f/src.h f/st.h f/target.o: f/target.c f/proj.h $(CONFIG_H) $(SYSTEM_H) glimits.h f/target.h \ $(TREE_H) f/bad.h f/bad.def f/where.h f/top.h f/malloc.h f/info.h \ - f/info-b.def f/info-k.def f/info-w.def f/type.h f/lex.h + f/info-b.def f/info-k.def f/info-w.def f/type.h f/lex.h diagnostic.h f/top.o: f/top.c f/proj.h $(CONFIG_H) $(SYSTEM_H) f/top.h f/malloc.h f/where.h \ glimits.h f/bad.h f/bad.def f/bit.h f/bld.h f/bld-op.def f/com.h \ f/com-rt.def $(TREE_H) f/info.h f/info-b.def f/info-k.def \ diff --git a/gcc/f/target.c b/gcc/f/target.c index a1a78018a96..36b61043f9b 100644 --- a/gcc/f/target.c +++ b/gcc/f/target.c @@ -1,5 +1,5 @@ /* target.c -- Implementation File (module.c template V1.0) - Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1998, 2002 Free Software Foundation, Inc. Contributed by James Craig Burley. This file is part of GNU Fortran. @@ -71,6 +71,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "proj.h" #include "glimits.h" #include "target.h" +#include "diagnostic.h" #include "bad.h" #include "info.h" #include "lex.h" @@ -2519,6 +2520,47 @@ ffetarget_verify_character1 (mallocPool pool, ffetargetCharacter1 val) void * ffetarget_memcpy_ (void *dst, void *src, size_t len) { +#ifdef CROSS_COMPILE + int host_words_big_endian = +#ifndef HOST_WORDS_BIG_ENDIAN + 0 +#else + HOST_WORDS_BIG_ENDIAN +#endif + ; + + int host_bytes_big_endian = +#ifndef HOST_BYTES_BIG_ENDIAN + 0 +#else + HOST_BYTES_BIG_ENDIAN +#endif + ; + + int host_bits_big_endian = +#ifndef HOST_BITS_BIG_ENDIAN + 0 +#else + HOST_BITS_BIG_ENDIAN +#endif + ; + + /* This is just hands thrown up in the air over bits coming through this + function representing a number being memcpy:d as-is from host to + target. We can't generally adjust endianness here since we don't + know whether it's an integer or floating point number; they're passed + differently. Better to not emit code at all than to emit wrong code. + We will get some false hits because some data coming through here + seems to be just character vectors, but often enough it's numbers, + for instance in g77.f-torture/execute/980628-[4-6].f and alpha2.f. + Still, we compile *some* code. FIXME: Rewrite handling of numbers. */ + if (!WORDS_BIG_ENDIAN != !host_words_big_endian + || !BYTES_BIG_ENDIAN != !host_bytes_big_endian + || !BITS_BIG_ENDIAN != !host_bits_big_endian) + sorry ("data initializer on host with different endianness"); + +#endif /* CROSS_COMPILE */ + return (void *) memcpy (dst, src, len); } -- 2.30.2