Re: [xml] XPath Infinities
- From: Bjorn Reese <breese mail1 stofanet dk>
- To: "'xml gnome org'" <xml gnome org>
- Subject: Re: [xml] XPath Infinities
- Date: Sat, 28 Apr 2001 15:08:42 +0000
Daniel Veillard wrote:
this whole issue is a huge mess ...
Indeed. We ought to extract all the NaN and Inf stuff into a separate file.
http://bugzilla.gnome.org/show_bug.cgi?id=52979
Actually, I am not sure that the patch in that bugreport solves the problem.
There seems to be two problems involved
1. getting the compiler to accept the division by zero (it usually ouputs
a warning, but that's ok)
2. getting the program to produce a NaN (normally it just returns 0 instead)
I did some experimentations, and it turned out that two different solutions
were needed on Alpha, depending on your compiler.
o with GCC the workaround is to ignore SIGFPE.
o with DECC (the vendor CC) the -ieee compiler option must be used.
I verified this will a small test program, not with libxml.
I have attached two small patches for libxml. Unfortunately, I have not
tested them myself as I don't have access to the GNOME CVS from the Alpha
machine. Could somebody check them out, and report whether they work or not?
If possible, I would like to hear if they work with both GCC and the vendor
CC.
those who succeed compiling 2.3.7 as it is. Those of us who use MSCC and
similar compilers would then be responsible to define this
XPATH_USE_DIVISION_SHORTCUTS macro somewhere. The alternative to this seems
There has got to be a better way.
Index: xpath.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/xpath.c,v
retrieving revision 1.107
diff -c -r1.107 xpath.c
*** xpath.c 2001/04/28 14:35:02 1.107
--- xpath.c 2001/04/28 15:04:14
***************
*** 39,44 ****
--- 39,48 ----
#ifdef HAVE_CTYPE_H
#include <ctype.h>
#endif
+ #if defined(__osf__) && defined(__GNUC__)
+ #include <signal.h>
+ #define FPE_WORKAROUND
+ #endif
#include <libxml/xmlmemory.h>
#include <libxml/tree.h>
***************
*** 156,161 ****
--- 160,169 ----
static int initialized = 0;
if (initialized) return;
+
+ #ifdef FPE_WORKAROUND
+ signal(SIGFPE, SIG_IGN);
+ #endif
#ifdef XPATH_USE_DIVISION_SHORTCUTS
xmlXPathNAN = 0;
Index: configure.in
===================================================================
RCS file: /cvs/gnome/gnome-xml/configure.in,v
retrieving revision 1.97
diff -c -r1.97 configure.in
*** configure.in 2001/04/23 13:41:34 1.97
--- configure.in 2001/04/28 15:02:36
***************
*** 157,170 ****
XML_CFLAGS=""
dnl
! dnl Workaround for HP native compiler
! dnl http://bugs.gnome.org/db/31/3163.html
dnl
if test "${GCC}" != "yes" ; then
case "${host}" in
*-*-hpux* )
CFLAGS="${CFLAGS} -Wp,-H30000"
;;
esac
else
CFLAGS="${CFLAGS} -Wall"
--- 157,174 ----
XML_CFLAGS=""
dnl
! dnl Workaround for native compilers
! dnl HP : http://bugs.gnome.org/db/31/3163.html
! dnl DEC : Enable NaN/Inf
dnl
if test "${GCC}" != "yes" ; then
case "${host}" in
*-*-hpux* )
CFLAGS="${CFLAGS} -Wp,-H30000"
;;
+ *-dec-osf* )
+ CFLAGS="${CFLAGS} -ieee"
+ ;;
esac
else
CFLAGS="${CFLAGS} -Wall"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]