8.2beta1 failure on IRIX
Started by Steve Singerover 19 years ago1 messages
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)
--
======================================================================