From 48568ec72b76246c3cf964b52fbe91fa018511e7 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Mon, 12 Jan 2004 03:55:43 +0000 Subject: [PATCH] re PR target/12148 (longstanding m68k libgcc.a bug when using ` -mshort') PR c/12148 * config/m68k/fpgnulib.c: Fix `-mshort' bugs: Use `long' instead of `int' in a number of places to make sure we always have a SImode and not a HImode. Add a 'L' suffix to a number of constants. From-SVN: r75703 --- gcc/ChangeLog | 7 +++++++ gcc/config/m68k/fpgnulib.c | 40 +++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d5c0f6d1044..a79c36e065a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2004-01-12 Markus F.X.J. Oberhumer + + PR c/12148 + * config/m68k/fpgnulib.c: Fix `-mshort' bugs: Use `long' instead of + `int' in a number of places to make sure we always have a SImode + and not a HImode. Add a 'L' suffix to a number of constants. + 2004-01-11 John David Anglin * pa.c: Don't include obstack.h. diff --git a/gcc/config/m68k/fpgnulib.c b/gcc/config/m68k/fpgnulib.c index 0559b628c87..5368559d4dd 100644 --- a/gcc/config/m68k/fpgnulib.c +++ b/gcc/config/m68k/fpgnulib.c @@ -59,24 +59,24 @@ #define PACK(s,e,m) ((s) | ((e) << 23L) | (m)) /* the following deal with IEEE double-precision numbers */ -#define EXCESSD 1022 +#define EXCESSD 1022L #define HIDDEND (1L << 20L) #define EXPDBITS 11 -#define EXPDMASK 0x7FF +#define EXPDMASK 0x7FFL #define EXPD(fp) (((fp.l.upper) >> 20L) & 0x7FFL) #define SIGND(fp) ((fp.l.upper) & SIGNBIT) #define MANTD(fp) (((((fp.l.upper) & 0xFFFFF) | HIDDEND) << 10) | \ (fp.l.lower >> 22)) -#define MANTDMASK 0xFFFFF /* mask of upper part */ +#define MANTDMASK 0xFFFFFL /* mask of upper part */ /* the following deal with IEEE extended-precision numbers */ -#define EXCESSX 16382 +#define EXCESSX 16382L #define HIDDENX (1L << 31L) #define EXPXBITS 15 #define EXPXMASK 0x7FFF #define EXPX(fp) (((fp.l.upper) >> 16) & EXPXMASK) #define SIGNX(fp) ((fp.l.upper) & SIGNBIT) -#define MANTXMASK 0x7FFFFFFF /* mask of upper part */ +#define MANTXMASK 0x7FFFFFFFL /* mask of upper part */ union double_long { @@ -107,7 +107,7 @@ union long_double_long /* convert int to double */ double -__floatsidf (int a1) +__floatsidf (long a1) { long sign = 0, exp = 31 + EXCESSD; union double_long dl; @@ -130,13 +130,13 @@ __floatsidf (int a1) } } - while (a1 < 0x1000000) + while (a1 < 0x1000000L) { a1 <<= 4; exp -= 4; } - while (a1 < 0x40000000) + while (a1 < 0x40000000L) { a1 <<= 1; exp--; @@ -153,7 +153,7 @@ __floatsidf (int a1) /* convert int to float */ float -__floatsisf (int l) +__floatsisf (long l) { double foo = __floatsidf (l); return foo; @@ -208,7 +208,7 @@ __truncdfsf2 (double a1) mant >>= 1; /* did the round overflow? */ - if (mant & 0xFF000000) + if (mant & 0xFF000000L) { mant >>= 1; exp++; @@ -222,7 +222,7 @@ __truncdfsf2 (double a1) } /* convert double to int */ -int +long __fixdfsi (double a1) { register union double_long dl1; @@ -240,7 +240,7 @@ __fixdfsi (double a1) if (exp > 0) { /* Return largest integer. */ - return SIGND (dl1) ? 0x80000000 : 0x7fffffff; + return SIGND (dl1) ? 0x80000000L : 0x7fffffffL; } if (exp <= -32) @@ -254,7 +254,7 @@ __fixdfsi (double a1) } /* convert float to int */ -int +long __fixsfsi (float a1) { double foo = a1; @@ -268,12 +268,12 @@ __fixsfsi (float a1) We assume all numbers are normalized, don't do any rounding, etc. */ /* Prototypes for the above in case we use them. */ -double __floatsidf (int); -float __floatsisf (int); +double __floatsidf (long); +float __floatsisf (long); double __extendsfdf2 (float); float __truncdfsf2 (double); -int __fixdfsi (double); -int __fixsfsi (float); +long __fixdfsi (double); +long __fixsfsi (float); /* convert double to long double */ long double @@ -351,17 +351,17 @@ __truncxfsf2 (long double ld) /* convert an int to a long double */ long double -__floatsixf (int l) +__floatsixf (long l) { double foo = __floatsidf (l); return foo; } /* convert a long double to an int */ -int +long __fixxfsi (long double ld) { - int foo = __fixdfsi ((double) ld); + long foo = __fixdfsi ((double) ld); return foo; } -- 2.30.2