Lobotomize test for float -Inf ^ -2, at least for now.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 16 Jun 2020 19:28:37 +0000 (15:28 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 16 Jun 2020 19:28:45 +0000 (15:28 -0400)
Per POSIX this case should produce +0, but buildfarm member fossa
(with icc (ICC) 19.0.5.281 20190815) is reporting -0.  icc has a
boatload of unsafe floating-point optimizations, with a corresponding
boatload of not-too-well-documented compiler switches, and it seems our
default use of "-mp1" isn't whacking it hard enough to keep it from
misoptimizing the stanza in dpow() that checks whether y is odd.
There's nothing wrong with that code (seeing that no other buildfarm
member has trouble with it), so I'm content to blame this on the
compiler.  But without access to the compiler I'm not going to guess at
what switches might be needed to fix it.  For now, tweak the test case
so it will accept either -0 or +0 as a correct answer.

Discussion: https://postgr.es/m/E1jkyFX-0005RR-1Q@gemulon.postgresql.org

src/test/regress/expected/float8.out
src/test/regress/sql/float8.sql

index 12b3d6223c693d0b85f5bf4e42f2b7b982e50b1a..c635dd7dcb67f47dbd87a38528b49e457755c6fa 100644 (file)
@@ -501,10 +501,12 @@ SELECT power(float8 'inf', float8 '-inf');
      0
 (1 row)
 
-SELECT power(float8 '-inf', float8 '-2');
- power 
--------
-     0
+-- Intel's icc misoptimizes the code that controls the sign of this result,
+-- even with -mp1.  Pending a fix for that, only test for "is it zero".
+SELECT power(float8 '-inf', float8 '-2') = '0';
+ ?column? 
+----------
+ t
 (1 row)
 
 SELECT power(float8 '-inf', float8 '-3');
index b628cb77b8c9946495c42fa08a52c7134c78def5..288969aed65d0090cd420fefcaf180452d23925c 100644 (file)
@@ -140,7 +140,9 @@ SELECT power(float8 'inf', float8 '-2');
 SELECT power(float8 'inf', float8 '2');
 SELECT power(float8 'inf', float8 'inf');
 SELECT power(float8 'inf', float8 '-inf');
-SELECT power(float8 '-inf', float8 '-2');
+-- Intel's icc misoptimizes the code that controls the sign of this result,
+-- even with -mp1.  Pending a fix for that, only test for "is it zero".
+SELECT power(float8 '-inf', float8 '-2') = '0';
 SELECT power(float8 '-inf', float8 '-3');
 SELECT power(float8 '-inf', float8 '2');
 SELECT power(float8 '-inf', float8 '3');