8.2beta1 failure on IRIX

Started by Nonameover 19 years ago6 messages
#1Noname
ssinger_pg@sympatico.ca
3 attachment(s)

I'm getting some failures in the regression tests on 8.2beta1 on IRIX.
It looks like IRIX (or at least some versions) has a broken strtod.

The float4 and float8 tests fail, I've attached a patch to
tools/adt/float.c that fixes the problem along with the regression output.

As a side note,could float4in not be refactored to just call float8in followed
by CheckFloat4Val and maybe some error message changes?
The two functions have a lot of duplicated code.

IRIX 6.5.22m
uname -R = 6.5 6.5.22m

Attachments:

float.c.difftext/plain; CHARSET=US-ASCII; NAME=float.c.diffDownload
Index: backend/utils/adt/float.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/float.c,v
retrieving revision 1.128
diff -c -w -r1.128 float.c
*** backend/utils/adt/float.c	28 Jul 2006 18:33:04 -0000	1.128
--- backend/utils/adt/float.c	30 Sep 2006 23:38:17 -0000
***************
*** 326,331 ****
--- 326,343 ----
  			endptr--;
  	}
  #endif   /* HAVE_BUGGY_SOLARIS_STRTOD */
+ 	if(endptr != num && pg_strncasecmp(endptr,"inity",5)==0 &&
+ 	   (pg_strncasecmp(num,"infinity",8)==0 || 
+ 	    pg_strncasecmp(num,"-infinity",9)==0 ) )
+ 	   {
+ 		/**
+ 		*
+ 		* Some versions of strtod (IRIX) stop
+ 		* parsing after "inf" and leave endptr as inity
+ 		*/
+ 		endptr+=5;
+         }
+ 
  
  	/* skip trailing whitespace */
  	while (*endptr != '\0' && isspace((unsigned char) *endptr))
***************
*** 342,349 ****
  	 * if we get here, we have a legal double, still need to check to see if
  	 * it's a legal float4
  	 */
! 	if (!isinf(val))
  		CheckFloat4Val(val);
  
  	PG_RETURN_FLOAT4((float4) val);
  }
--- 354,373 ----
  	 * if we get here, we have a legal double, still need to check to see if
  	 * it's a legal float4
  	 */
! 	if (!isinf(val)) {
  		CheckFloat4Val(val);
+ 	}
+ 	else {
+ 	  /**
+ 	   * If val is infinity, make sure that -infinity
+ 	   * was not asked for.  Some implementations of strtod
+ 	   * return inf when passed -inf
+ 	   */
+ 	  if(pg_strncasecmp(num,"-Infinity",9)==0 ||
+ 	     pg_strncasecmp(num,"-Inf",5)==0) {
+ 	    val = -get_float4_infinity();
+ 	  }
+ 	}
  
  	PG_RETURN_FLOAT4((float4) val);
  }
***************
*** 493,498 ****
--- 517,533 ----
  			endptr--;
  	}
  #endif   /* HAVE_BUGGY_SOLARIS_STRTOD */
+ 	if(endptr != num && pg_strncasecmp(endptr,"inity",5)==0 &&
+ 	   (pg_strncasecmp(num,"infinity",8)==0 || 
+ 	    pg_strncasecmp(num,"-infinity",9)==0 ) )
+ 	   {
+ 		/**
+ 		*
+ 		* Some versions of strtod (IRIX) stop
+ 		* parsing after "inf" and leave endptr as inity
+ 		*/
+ 		endptr+=5;
+         }
  
  	/* skip trailing whitespace */
  	while (*endptr != '\0' && isspace((unsigned char) *endptr))
***************
*** 507,513 ****
  
  	if (!isinf(val))
  		CheckFloat8Val(val);
! 
  	PG_RETURN_FLOAT8(val);
  }
  
--- 542,558 ----
  
  	if (!isinf(val))
  		CheckFloat8Val(val);
! 	else {
! 	  /**
! 	   * If val is infinity, make sure that -infinity
! 	   * was not asked for.  Some implementations of strtod
! 	   * return inf when passed -inf
! 	   */
! 	  if(pg_strncasecmp(num,"-Infinity",9)==0 ||
! 	     pg_strncasecmp(num,"-Inf",5)==0) {
! 	    val = -get_float4_infinity();
! 	  }
! 	}
  	PG_RETURN_FLOAT8(val);
  }
  
regression.diffstext/plain; CHARSET=US-ASCII; NAME=regression.diffsDownload
*** ./expected/float4.out	Wed Apr  6 21:51:40 2005
--- ./results/float4.out	Sat Sep 30 19:46:24 2006
***************
*** 53,69 ****
  (1 row)
  
  SELECT 'infinity'::float4;
!   float4  
! ----------
!  Infinity
! (1 row)
! 
  SELECT '          -INFINiTY   '::float4;
!   float4   
! -----------
!  -Infinity
! (1 row)
! 
  -- bad special inputs
  SELECT 'N A N'::float4;
  ERROR:  invalid input syntax for type real: "N A N"
--- 53,61 ----
  (1 row)
  
  SELECT 'infinity'::float4;
! ERROR:  invalid input syntax for type real: "infinity"
  SELECT '          -INFINiTY   '::float4;
! ERROR:  invalid input syntax for type real: "          -INFINiTY   "
  -- bad special inputs
  SELECT 'N A N'::float4;
  ERROR:  invalid input syntax for type real: "N A N"
***************
*** 72,84 ****
  SELECT ' INFINITY    x'::float4;
  ERROR:  invalid input syntax for type real: " INFINITY    x"
  SELECT 'Infinity'::float4 + 100.0;
! ERROR:  type "double precision" value out of range: overflow
  SELECT 'Infinity'::float4 / 'Infinity'::float4;
!  ?column? 
! ----------
!       NaN
! (1 row)
! 
  SELECT 'nan'::float4 / 'nan'::float4;
   ?column? 
  ----------
--- 64,72 ----
  SELECT ' INFINITY    x'::float4;
  ERROR:  invalid input syntax for type real: " INFINITY    x"
  SELECT 'Infinity'::float4 + 100.0;
! ERROR:  invalid input syntax for type real: "Infinity"
  SELECT 'Infinity'::float4 / 'Infinity'::float4;
! ERROR:  invalid input syntax for type real: "Infinity"
  SELECT 'nan'::float4 / 'nan'::float4;
   ?column? 
  ----------

======================================================================

*** ./expected/float8.out	Wed Jun  8 17:15:29 2005
--- ./results/float8.out	Sat Sep 30 19:46:24 2006
***************
*** 53,69 ****
  (1 row)
  
  SELECT 'infinity'::float8;
!   float8  
! ----------
!  Infinity
! (1 row)
! 
  SELECT '          -INFINiTY   '::float8;
!   float8   
! -----------
!  -Infinity
! (1 row)
! 
  -- bad special inputs
  SELECT 'N A N'::float8;
  ERROR:  invalid input syntax for type double precision: "N A N"
--- 53,61 ----
  (1 row)
  
  SELECT 'infinity'::float8;
! ERROR:  invalid input syntax for type double precision: "infinity"
  SELECT '          -INFINiTY   '::float8;
! ERROR:  invalid input syntax for type double precision: "          -INFINiTY   "
  -- bad special inputs
  SELECT 'N A N'::float8;
  ERROR:  invalid input syntax for type double precision: "N A N"
***************
*** 72,84 ****
  SELECT ' INFINITY    x'::float8;
  ERROR:  invalid input syntax for type double precision: " INFINITY    x"
  SELECT 'Infinity'::float8 + 100.0;
! ERROR:  type "double precision" value out of range: overflow
  SELECT 'Infinity'::float8 / 'Infinity'::float8;
!  ?column? 
! ----------
!       NaN
! (1 row)
! 
  SELECT 'nan'::float8 / 'nan'::float8;
   ?column? 
  ----------
--- 64,72 ----
  SELECT ' INFINITY    x'::float8;
  ERROR:  invalid input syntax for type double precision: " INFINITY    x"
  SELECT 'Infinity'::float8 + 100.0;
! ERROR:  invalid input syntax for type double precision: "Infinity"
  SELECT 'Infinity'::float8 / 'Infinity'::float8;
! ERROR:  invalid input syntax for type double precision: "Infinity"
  SELECT 'nan'::float8 / 'nan'::float8;
   ?column? 
  ----------

======================================================================

*** ./expected/geometry_2.out	Sat Sep  9 20:29:35 2006
--- ./results/geometry.out	Sat Sep 30 19:46:34 2006
***************
*** 228,237 ****
     FROM BOX_TBL b, POINT_TBL p;
   twentyfour |          rotation           
  ------------+-----------------------------
!             | (0,0),(0,0)
!             | (0,0),(0,0)
!             | (0,0),(0,0)
!             | (0,0),(0,0)
              | (-0,0),(-20,-20)
              | (-10,-10),(-30,-30)
              | (-25,-25),(-25,-35)
--- 228,237 ----
     FROM BOX_TBL b, POINT_TBL p;
   twentyfour |          rotation           
  ------------+-----------------------------
!             | (-0,0),(-0,0)
!             | (-0,0),(-0,0)
!             | (-0,0),(-0,0)
!             | (-0,0),(-0,0)
              | (-0,0),(-20,-20)
              | (-10,-10),(-30,-30)
              | (-25,-25),(-25,-35)
***************
*** 240,257 ****
              | (-7,3),(-21,1)
              | (-17.5,2.5),(-21.5,-0.5)
              | (-21,3),(-21,3)
!             | (0,79.2),(-58.8,0)
              | (-29.4,118.8),(-88.2,39.6)
              | (-73.5,104.1),(-108,99)
              | (-88.2,118.8),(-88.2,118.8)
!             | (14,-0),(0,-34)
              | (21,-17),(7,-51)
              | (29.5,-42.5),(17.5,-47.5)
              | (21,-51),(21,-51)
!             | (0,40),(0,0)
!             | (0,60),(0,20)
!             | (0,60),(-10,50)
!             | (0,60),(0,60)
  (24 rows)
  
  SELECT '' AS twenty, b.f1 / p.f1 AS rotation
--- 240,257 ----
              | (-7,3),(-21,1)
              | (-17.5,2.5),(-21.5,-0.5)
              | (-21,3),(-21,3)
!             | (-0,79.2),(-58.8,0)
              | (-29.4,118.8),(-88.2,39.6)
              | (-73.5,104.1),(-108,99)
              | (-88.2,118.8),(-88.2,118.8)
!             | (14,-0),(-0,-34)
              | (21,-17),(7,-51)
              | (29.5,-42.5),(17.5,-47.5)
              | (21,-51),(21,-51)
!             | (-0,40),(-0,0)
!             | (-0,60),(-0,20)
!             | (-0,60),(-10,50)
!             | (-0,60),(-0,60)
  (24 rows)
  
  SELECT '' AS twenty, b.f1 / p.f1 AS rotation
***************
*** 267,284 ****
          | (0.12,-0.28),(0.04,-0.84)
          | (0.26,-0.7),(0.1,-0.82)
          | (0.12,-0.84),(0.12,-0.84)
!         | (0.0651176557644,0),(0,-0.0483449262493)
          | (0.0976764836466,-0.0241724631247),(0.0325588278822,-0.072517389374)
          | (0.109762715209,-0.0562379754329),(0.0813970697055,-0.0604311578117)
          | (0.0976764836466,-0.072517389374),(0.0976764836466,-0.072517389374)
!         | (-0,0.0828402366864),(-0.201183431953,0)
          | (-0.100591715976,0.12426035503),(-0.301775147929,0.0414201183432)
          | (-0.251479289941,0.103550295858),(-0.322485207101,0.0739644970414)
          | (-0.301775147929,0.12426035503),(-0.301775147929,0.12426035503)
!         | (0.2,0),(0,0)
!         | (0.3,0),(0.1,0)
!         | (0.3,0.05),(0.25,0)
!         | (0.3,0),(0.3,0)
  (20 rows)
  
  --
--- 267,284 ----
          | (0.12,-0.28),(0.04,-0.84)
          | (0.26,-0.7),(0.1,-0.82)
          | (0.12,-0.84),(0.12,-0.84)
!         | (0.0651176557644,-0),(0,-0.0483449262493)
          | (0.0976764836466,-0.0241724631247),(0.0325588278822,-0.072517389374)
          | (0.109762715209,-0.0562379754329),(0.0813970697055,-0.0604311578117)
          | (0.0976764836466,-0.072517389374),(0.0976764836466,-0.072517389374)
!         | (-0,0.0828402366864),(-0.201183431953,-0)
          | (-0.100591715976,0.12426035503),(-0.301775147929,0.0414201183432)
          | (-0.251479289941,0.103550295858),(-0.322485207101,0.0739644970414)
          | (-0.301775147929,0.12426035503),(-0.301775147929,0.12426035503)
!         | (0.2,-0),(0,-0)
!         | (0.3,-0),(0.1,-0)
!         | (0.3,0.05),(0.25,-0)
!         | (0.3,-0),(0.3,-0)
  (20 rows)
  
  --

======================================================================

regression.outtext/plain; CHARSET=US-ASCII; NAME=regression.outDownload
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Noname (#1)
Re: 8.2beta1 failure on IRIX

ssinger_pg@sympatico.ca writes:

I'm getting some failures in the regression tests on 8.2beta1 on IRIX.
It looks like IRIX (or at least some versions) has a broken strtod.
The float4 and float8 tests fail, I've attached a patch to
tools/adt/float.c that fixes the problem along with the regression output.

That patch is pretty seriously broken (not only because it's not ifdef'd
to apply only on the platform that needs it, but because it'll do the
wrong thing with "infinityinity"). But what I'm really wondering is why
we've not heard of this before? That code hasn't been changed in quite
some time.

regards, tom lane

#3Steve Singer
ssinger_pg@sympatico.ca
In reply to: Tom Lane (#2)
1 attachment(s)
Re: 8.2beta1 failure on IRIX

On Sun, 1 Oct 2006, Tom Lane wrote:

Does this version of the patch address your concerns.

Some searching of the net shows that this has been reported before. Once in
the beta for 8.1 and again in January as bug #2192 (It looks like a patch
was included then but wasn't applied).

It seems like only certain versions of IRIX have this problem but I don't
know how common it is or what versions don't have the bug. Unless we want
to drop IRIX from the list of supported platforms we should apply one of the
fixes.

Show quoted text

ssinger_pg@sympatico.ca writes:

I'm getting some failures in the regression tests on 8.2beta1 on IRIX.
It looks like IRIX (or at least some versions) has a broken strtod.
The float4 and float8 tests fail, I've attached a patch to
tools/adt/float.c that fixes the problem along with the regression output.

That patch is pretty seriously broken (not only because it's not ifdef'd
to apply only on the platform that needs it, but because it'll do the
wrong thing with "infinityinity"). But what I'm really wondering is why
we've not heard of this before? That code hasn't been changed in quite
some time.

regards, tom lane

Attachments:

float_irix_patch.difftext/plain; charset=US-ASCII; name=float_irix_patch.diffDownload
Index: backend/utils/adt/float.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/float.c,v
retrieving revision 1.128
diff -c -r1.128 float.c
*** backend/utils/adt/float.c	28 Jul 2006 18:33:04 -0000	1.128
--- backend/utils/adt/float.c	4 Oct 2006 21:16:20 -0000
***************
*** 327,332 ****
--- 327,347 ----
  	}
  #endif   /* HAVE_BUGGY_SOLARIS_STRTOD */
  
+ #ifdef HAVE_BUGGY_IRIX_STRTOD
+ 	if(endptr != num && pg_strncasecmp(endptr,"inity",5)==0 &&
+ 	   endptr - num <=4 &&
+ 	   (pg_strncasecmp(num,"infinity",8)==0 || 
+ 	    pg_strncasecmp(num,"-infinity",9)==0 ) )
+ 	   {
+ 		/**
+ 		*
+ 		* Some versions of strtod (IRIX) stop
+ 		* parsing after "inf" and leave endptr as inity
+ 		*/
+ 		endptr+=5;
+         }
+ #endif
+ 
  	/* skip trailing whitespace */
  	while (*endptr != '\0' && isspace((unsigned char) *endptr))
  		endptr++;
***************
*** 344,349 ****
--- 359,377 ----
  	 */
  	if (!isinf(val))
  		CheckFloat4Val(val);
+ #ifdef HAVE_BUGGY_IRIX_STRTOD
+ 	else {
+ 	  /**
+ 	   * If val is infinity, make sure that -infinity
+ 	   * was not asked for.  Some implementations of strtod
+ 	   * return inf when passed -inf
+ 	   */
+ 	  if(pg_strncasecmp(num,"-Infinity",9)==0 ||
+ 	     pg_strncasecmp(num,"-Inf",4)==0) {
+ 	    val = -get_float4_infinity();
+ 	  }
+ 	}
+ #endif
  
  	PG_RETURN_FLOAT4((float4) val);
  }
***************
*** 494,499 ****
--- 522,542 ----
  	}
  #endif   /* HAVE_BUGGY_SOLARIS_STRTOD */
  
+ #ifdef HAVE_BUGGY_IRIX_STRTOD
+ 	if(endptr != num && pg_strncasecmp(endptr,"inity",5)==0 &&
+ 	   endptr - num <=4 &&
+ 	   (pg_strncasecmp(num,"infinity",8)==0 || 
+ 	    pg_strncasecmp(num,"-infinity",9)==0 ) )
+         {
+ 	       /**
+ 		*
+ 		* Some versions of strtod (IRIX) stop
+ 		* parsing after "inf" and leave endptr as inity
+ 		*/
+ 		endptr+=5;
+ 	}
+ #endif
+ 
  	/* skip trailing whitespace */
  	while (*endptr != '\0' && isspace((unsigned char) *endptr))
  		endptr++;
***************
*** 507,513 ****
  
  	if (!isinf(val))
  		CheckFloat8Val(val);
! 
  	PG_RETURN_FLOAT8(val);
  }
  
--- 550,568 ----
  
  	if (!isinf(val))
  		CheckFloat8Val(val);
! #ifdef HAVE_BUGGY_IRIX_STRTOD
! 	else {
! 	  /**
! 	   * If val is infinity, make sure that -infinity
! 	   * was not asked for.  Some implementations of strtod
! 	   * return inf when passed -inf
! 	   */
! 	  if(pg_strncasecmp(num,"-Infinity",9)==0 ||
! 	     pg_strncasecmp(num,"-Inf",4)==0) {
! 	    val = -get_float8_infinity();
! 	  }
! 	}
! #endif
  	PG_RETURN_FLOAT8(val);
  }
  
Index: include/port/irix.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/port/irix.h,v
retrieving revision 1.3
diff -c -r1.3 irix.h
*** include/port/irix.h	11 Mar 2006 04:38:38 -0000	1.3
--- include/port/irix.h	4 Oct 2006 21:16:23 -0000
***************
*** 1 ****
--- 1,2 ----
  /* $PostgreSQL: pgsql/src/include/port/irix.h,v 1.3 2006/03/11 04:38:38 momjian Exp $ */
+ #define HAVE_BUGGY_IRIX_STRTOD 1
Index: test/regress/expected/float4.out
===================================================================
RCS file: /projects/cvsroot/pgsql/src/test/regress/expected/float4.out,v
retrieving revision 1.13
diff -c -r1.13 float4.out
*** test/regress/expected/float4.out	7 Apr 2005 01:51:40 -0000	1.13
--- test/regress/expected/float4.out	4 Oct 2006 21:16:25 -0000
***************
*** 85,90 ****
--- 85,94 ----
        NaN
  (1 row)
  
+ SELECT 'infinityinity'::float4;
+ ERROR:  invalid input syntax for type real: "infinityinity"
+ SELECT '-infinityinity'::float4;
+ ERROR:  invalid input syntax for type real: "-infinityinity"
  SELECT '' AS five, * FROM FLOAT4_TBL;
   five |     f1      
  ------+-------------
Index: test/regress/expected/float8.out
===================================================================
RCS file: /projects/cvsroot/pgsql/src/test/regress/expected/float8.out,v
retrieving revision 1.24
diff -c -r1.24 float8.out
*** test/regress/expected/float8.out	8 Jun 2005 21:15:29 -0000	1.24
--- test/regress/expected/float8.out	4 Oct 2006 21:16:25 -0000
***************
*** 85,90 ****
--- 85,94 ----
        NaN
  (1 row)
  
+ SELECT 'infinityinity'::float8;
+ ERROR: invalid input syntax for type double precision: "infinityinity"
+ SELECT '-infinityinity'::float8;
+ ERROR: invalid input syntax for type double precision: "-infinityinity"
  SELECT '' AS five, * FROM FLOAT8_TBL;
   five |          f1          
  ------+----------------------
Index: test/regress/sql/float4.sql
===================================================================
RCS file: /projects/cvsroot/pgsql/src/test/regress/sql/float4.sql,v
retrieving revision 1.8
diff -c -r1.8 float4.sql
*** test/regress/sql/float4.sql	7 Apr 2005 01:51:41 -0000	1.8
--- test/regress/sql/float4.sql	4 Oct 2006 21:16:25 -0000
***************
*** 40,46 ****
  SELECT 'Infinity'::float4 + 100.0;
  SELECT 'Infinity'::float4 / 'Infinity'::float4;
  SELECT 'nan'::float4 / 'nan'::float4;
! 
  
  SELECT '' AS five, * FROM FLOAT4_TBL;
  
--- 40,47 ----
  SELECT 'Infinity'::float4 + 100.0;
  SELECT 'Infinity'::float4 / 'Infinity'::float4;
  SELECT 'nan'::float4 / 'nan'::float4;
! SELECT 'infinityinity'::float4;
! SELECT '-infinityinity'::float4;
  
  SELECT '' AS five, * FROM FLOAT4_TBL;
  
Index: test/regress/sql/float8.sql
===================================================================
RCS file: /projects/cvsroot/pgsql/src/test/regress/sql/float8.sql,v
retrieving revision 1.15
diff -c -r1.15 float8.sql
*** test/regress/sql/float8.sql	8 Jun 2005 21:15:29 -0000	1.15
--- test/regress/sql/float8.sql	4 Oct 2006 21:16:25 -0000
***************
*** 40,45 ****
--- 40,47 ----
  SELECT 'Infinity'::float8 + 100.0;
  SELECT 'Infinity'::float8 / 'Infinity'::float8;
  SELECT 'nan'::float8 / 'nan'::float8;
+ SELECT 'infinityinity'::float8;
+ SELECT '-infinityinity'::float8;
  
  SELECT '' AS five, * FROM FLOAT8_TBL;
  
#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Noname (#1)
Re: 8.2beta1 failure on IRIX

Steve Singer <ssinger_pg@sympatico.ca> writes:

Some searching of the net shows that this has been reported before. Once in
the beta for 8.1 and again in January as bug #2192 (It looks like a patch
was included then but wasn't applied).

Yeah, I see that, not sure why we didn't apply that patch. Will work on
this.

regards, tom lane

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Noname (#1)
Re: 8.2beta1 failure on IRIX

I've applied the attached patch which merges ideas from your version and
John Jorgensen's. Please check it.

regards, tom lane

*** src/backend/utils/adt/float.c.orig	Tue Oct  3 23:16:36 2006
--- src/backend/utils/adt/float.c	Wed Oct  4 21:21:17 2006
***************
*** 328,333 ****
--- 328,359 ----
  	}
  #endif   /* HAVE_BUGGY_SOLARIS_STRTOD */
+ #ifdef HAVE_BUGGY_IRIX_STRTOD
+ 	/*
+ 	 * In some IRIX versions, strtod() recognizes only "inf", so if the
+ 	 * input is "infinity" we have to skip over "inity".  Also, it may
+ 	 * return positive infinity for "-inf".
+ 	 */
+ 	if (isinf(val))
+ 	{
+ 		if (pg_strncasecmp(num, "Infinity", 8) == 0)
+ 		{
+ 			val = get_float4_infinity();
+ 			endptr = num + 8;
+ 		}
+ 		else if (pg_strncasecmp(num, "-Infinity", 9) == 0)
+ 		{
+ 			val = -get_float4_infinity();
+ 			endptr = num + 9;
+ 		}
+ 		else if (pg_strncasecmp(num, "-inf", 4) == 0)
+ 		{
+ 			val = -get_float4_infinity();
+ 			endptr = num + 4;
+ 		}
+ 	}
+ #endif /* HAVE_BUGGY_IRIX_STRTOD */
+ 
  	/* skip trailing whitespace */
  	while (*endptr != '\0' && isspace((unsigned char) *endptr))
  		endptr++;
***************
*** 494,499 ****
--- 520,551 ----
  			endptr--;
  	}
  #endif   /* HAVE_BUGGY_SOLARIS_STRTOD */
+ 
+ #ifdef HAVE_BUGGY_IRIX_STRTOD
+ 	/*
+ 	 * In some IRIX versions, strtod() recognizes only "inf", so if the
+ 	 * input is "infinity" we have to skip over "inity".  Also, it may
+ 	 * return positive infinity for "-inf".
+ 	 */
+ 	if (isinf(val))
+ 	{
+ 		if (pg_strncasecmp(num, "Infinity", 8) == 0)
+ 		{
+ 			val = get_float8_infinity();
+ 			endptr = num + 8;
+ 		}
+ 		else if (pg_strncasecmp(num, "-Infinity", 9) == 0)
+ 		{
+ 			val = -get_float8_infinity();
+ 			endptr = num + 9;
+ 		}
+ 		else if (pg_strncasecmp(num, "-inf", 4) == 0)
+ 		{
+ 			val = -get_float8_infinity();
+ 			endptr = num + 4;
+ 		}
+ 	}
+ #endif /* HAVE_BUGGY_IRIX_STRTOD */
  	/* skip trailing whitespace */
  	while (*endptr != '\0' && isspace((unsigned char) *endptr))
*** src/include/port/irix.h.orig	Fri Mar 10 23:38:38 2006
--- src/include/port/irix.h	Wed Oct  4 21:20:50 2006
***************
*** 1 ****
--- 1,7 ----
  /* $PostgreSQL: pgsql/src/include/port/irix.h,v 1.3 2006/03/11 04:38:38 momjian Exp $ */
+ 
+ /*
+  * IRIX 6.5.26f and 6.5.22f (at least) have a strtod() that accepts
+  * "infinity", but leaves endptr pointing to "inity".
+  */
+ #define HAVE_BUGGY_IRIX_STRTOD
#6Steve Singer
ssinger_pg@sympatico.ca
In reply to: Tom Lane (#5)
Re: 8.2beta1 failure on IRIX

On Wed, 4 Oct 2006, Tom Lane wrote:

I've applied the patch and it seems to fix the problems.

8.2beta1 + the patch passes all of the regression tests on the IRIX box
(accept the expected difference with the geometry test).

Show quoted text

I've applied the attached patch which merges ideas from your version and
John Jorgensen's. Please check it.

regards, tom lane

*** src/backend/utils/adt/float.c.orig	Tue Oct  3 23:16:36 2006
--- src/backend/utils/adt/float.c	Wed Oct  4 21:21:17 2006
***************
*** 328,333 ****
--- 328,359 ----
}
#endif   /* HAVE_BUGGY_SOLARIS_STRTOD */
+ #ifdef HAVE_BUGGY_IRIX_STRTOD
+ 	/*
+ 	 * In some IRIX versions, strtod() recognizes only "inf", so if the
+ 	 * input is "infinity" we have to skip over "inity".  Also, it may
+ 	 * return positive infinity for "-inf".
+ 	 */
+ 	if (isinf(val))
+ 	{
+ 		if (pg_strncasecmp(num, "Infinity", 8) == 0)
+ 		{
+ 			val = get_float4_infinity();
+ 			endptr = num + 8;
+ 		}
+ 		else if (pg_strncasecmp(num, "-Infinity", 9) == 0)
+ 		{
+ 			val = -get_float4_infinity();
+ 			endptr = num + 9;
+ 		}
+ 		else if (pg_strncasecmp(num, "-inf", 4) == 0)
+ 		{
+ 			val = -get_float4_infinity();
+ 			endptr = num + 4;
+ 		}
+ 	}
+ #endif /* HAVE_BUGGY_IRIX_STRTOD */
+
/* skip trailing whitespace */
while (*endptr != '\0' && isspace((unsigned char) *endptr))
endptr++;
***************
*** 494,499 ****
--- 520,551 ----
endptr--;
}
#endif   /* HAVE_BUGGY_SOLARIS_STRTOD */
+
+ #ifdef HAVE_BUGGY_IRIX_STRTOD
+ 	/*
+ 	 * In some IRIX versions, strtod() recognizes only "inf", so if the
+ 	 * input is "infinity" we have to skip over "inity".  Also, it may
+ 	 * return positive infinity for "-inf".
+ 	 */
+ 	if (isinf(val))
+ 	{
+ 		if (pg_strncasecmp(num, "Infinity", 8) == 0)
+ 		{
+ 			val = get_float8_infinity();
+ 			endptr = num + 8;
+ 		}
+ 		else if (pg_strncasecmp(num, "-Infinity", 9) == 0)
+ 		{
+ 			val = -get_float8_infinity();
+ 			endptr = num + 9;
+ 		}
+ 		else if (pg_strncasecmp(num, "-inf", 4) == 0)
+ 		{
+ 			val = -get_float8_infinity();
+ 			endptr = num + 4;
+ 		}
+ 	}
+ #endif /* HAVE_BUGGY_IRIX_STRTOD */
/* skip trailing whitespace */
while (*endptr != '\0' && isspace((unsigned char) *endptr))
*** src/include/port/irix.h.orig	Fri Mar 10 23:38:38 2006
--- src/include/port/irix.h	Wed Oct  4 21:20:50 2006
***************
*** 1 ****
--- 1,7 ----
/* $PostgreSQL: pgsql/src/include/port/irix.h,v 1.3 2006/03/11 04:38:38 momjian Exp $ */
+
+ /*
+  * IRIX 6.5.26f and 6.5.22f (at least) have a strtod() that accepts
+  * "infinity", but leaves endptr pointing to "inity".
+  */
+ #define HAVE_BUGGY_IRIX_STRTOD