summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rwxr-xr-xgeneric/tclStrToD.c21
-rw-r--r--unix/tcl.m423
3 files changed, 47 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 895a5f6..ae1947d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-01 Andreas Kupries <andreask@activestate.com>
+
+ * generic/tclStrToD.c: Applied patch for [Bug 1839067] (fp
+ * unix/tcl.m4: rounding setup on solaris x86, native cc), provided
+ by Michael Schlenker.
+
2008-04-01 Don Porter <dgp@users.sourceforge.net>
* generic/tclStubLib.c (Tcl_InitStubs): Added missing error message.
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c
index e5e863b..2b4cde7 100755
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclStrToD.c,v 1.33 2008/03/13 17:14:19 dgp Exp $
+ * RCS: @(#) $Id: tclStrToD.c,v 1.34 2008/04/01 20:08:22 andreas_kupries Exp $
*
*----------------------------------------------------------------------
*/
@@ -61,6 +61,13 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
# define ADJUST_FPU_CONTROL_WORD
#endif
+/* Sun ProC needs sunmath for rounding control on x86 like gcc above.
+ *
+ *
+ */
+#if defined(__sun) && defined(__i386) && !defined(__GNUC__)
+#include <sunmath.h>
+#endif
/*
* HP's PA_RISC architecture uses 7ff4000000000000 to represent a quiet NaN.
* Everyone else uses 7ff8000000000000. (Why, HP, why?)
@@ -1309,6 +1316,9 @@ MakeLowPrecisionDouble(
_FPU_GETCW(oldRoundingMode);
_FPU_SETCW(roundTo53Bits);
#endif
+#if defined(__sun) && defined(__i386) && !defined(__GNUC__)
+ ieee_flags("set","precision","double",NULL);
+#endif
/*
* Test for the easy cases.
@@ -1381,6 +1391,9 @@ MakeLowPrecisionDouble(
#if defined(__GNUC__) && defined(__i386)
_FPU_SETCW(oldRoundingMode);
#endif
+#if defined(__sun) && defined(__i386) && !defined(__GNUC__)
+ ieee_flags("clear","precision",NULL,NULL);
+#endif
return retval;
}
@@ -1427,6 +1440,9 @@ MakeHighPrecisionDouble(
_FPU_GETCW(oldRoundingMode);
_FPU_SETCW(roundTo53Bits);
#endif
+#if defined(__sun) && defined(__i386) && !defined(__GNUC__)
+ ieee_flags("set","precision","double",NULL);
+#endif
/*
* Quick checks for over/underflow.
@@ -1485,6 +1501,9 @@ MakeHighPrecisionDouble(
#if defined(__GNUC__) && defined(__i386)
_FPU_SETCW(oldRoundingMode);
#endif
+#if defined(__sun) && defined(__i386) && !defined(__GNUC__)
+ ieee_flags("clear","precision",NULL,NULL);
+#endif
return retval;
}
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 0b69ba0..1550ab0 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -1931,6 +1931,24 @@ dnl AC_CHECK_TOOL(AR, ar)
], [AC_MSG_WARN([64bit mode not supported for $arch])])])
])
+ #--------------------------------------------------------------------
+ # On Solaris 5.x i386 with the sunpro compiler we need to link
+ # with sunmath to get floating point rounding control
+ #--------------------------------------------------------------------
+ AS_IF([test "$GCC" = yes],[use_sunmath=no],[
+ arch=`isainfo`
+ AC_MSG_CHECKING([whether to use -lsunmath for fp rounding control])
+ AS_IF([test "$arch" = "amd64 i386"], [
+ AC_MSG_RESULT([yes])
+ MATH_LIBS="-lsunmath $MATH_LIBS"
+ AC_CHECK_HEADER(sunmath.h)
+ use_sunmath=yes
+ ], [
+ AC_MSG_RESULT([no])
+ use_sunmath=no
+ ])
+ ])
+
# Note: need the LIBS below, otherwise Tk won't find Tcl's
# symbols when dynamically loaded into tclsh.
@@ -1952,11 +1970,12 @@ dnl AC_CHECK_TOOL(AR, ar)
#CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
])
], [
+ AS_IF([test "$use_sunmath" = yes], [textmode=textoff],[textmode=text])
case $system in
SunOS-5.[[1-9]][[0-9]]*)
- SHLIB_LD='${CC} -G -z text ${LDFLAGS}';;
+ SHLIB_LD="${CC} -G -z $textmode \${LDFLAGS}";;
*)
- SHLIB_LD='/usr/ccs/bin/ld -G -z text';;
+ SHLIB_LD="/usr/ccs/bin/ld -G -z $textmode";;
esac
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'