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
This commit is contained in:
Hans-Peter Nilsson 2002-04-08 22:20:39 +00:00 committed by Hans-Peter Nilsson
parent dc79864588
commit adb563c471
3 changed files with 52 additions and 3 deletions

View file

@ -1,3 +1,10 @@
2002-04-08 Hans-Peter Nilsson <hp@bitrange.com>
* 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 <neil@daikokuya.demon.co.uk>
* com.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Redefine.

View file

@ -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 \

View file

@ -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);
}