[gs-cvs] rev 8442 - trunk/gs/src

alexcher at ghostscript.com alexcher at ghostscript.com
Fri Dec 14 11:51:04 PST 2007


Author: alexcher
Date: 2007-12-14 11:51:01 -0800 (Fri, 14 Dec 2007)
New Revision: 8442

Modified:
   trunk/gs/src/ibnum.c
Log:
Work around a GCC 4.2.1 bug on PowerPC that generates incorrect code in the
release build affecting scanning of binary tokens containing floating point
numbers. Bug 689586.

DIFFERENCES:
None


Modified: trunk/gs/src/ibnum.c
===================================================================
--- trunk/gs/src/ibnum.c	2007-12-14 18:40:31 UTC (rev 8441)
+++ trunk/gs/src/ibnum.c	2007-12-14 19:51:01 UTC (rev 8442)
@@ -193,6 +193,20 @@
     return v;
 }
 
+
+/* Decode a 32-bit number. Return the resukt through a pointer */
+/* to work around a gcc 4.2.1 bug on PowerPC, bug 689586 */
+static void
+sdecodebits32(const byte * p, int format, bits32 *v)
+{
+  int a = p[0], b = p[1], c = p[2], d = p[3];
+  *v = (num_is_lsb(format) ?
+	    ((long)d << 24) + ((long)c << 16) + (b << 8) + a :
+	    ((long)a << 24) + ((long)b << 16) + (c << 8) + d);
+
+}
+
+
 /* Decode a float.  We assume that native floats occupy 32 bits. */
 /* If the float is an IEEE NaN or Inf, return e_undefinedresult. */
 int
@@ -211,7 +225,7 @@
 #endif
 	lnum = *(bits32 *)pfnum;
     } else {
-	lnum = (bits32) sdecodelong(p, format);
+	sdecodebits32(p, format, &lnum);
 
 #if !ARCH_FLOATS_ARE_IEEE
 	{



More information about the gs-cvs mailing list