[Pkg-postgresql-public] Bug#855606: sqrt() regression on powerpc/jessie

Christoph Berg myon at debian.org
Mon Feb 20 18:30:04 UTC 2017


Package: libc6
Version: 2.19-18+deb8u7
Severity: normal
Tags: jessie

The following C program produces different output on Jessie and Sid. I
believe the Sid output is the correct one, and in fact this is the
output that has been observed for the "point" (and "polygon")
regression tests for PostgreSQL on all platforms for the last 20 years
since the test got added.


$ cat sqrt.c
#include <math.h>
#include <stdio.h>
#include <fenv.h>

double
pg_hypot(double x, double y)
{
    double      yx;

    /* Some PG-specific code deleted here */

    /* Else, drop any minus signs */
    x = fabs(x);
    y = fabs(y);

    /* Swap x and y if needed to make x the larger one */
    if (x < y)
    {
        double      temp = x;

        x = y;
        y = temp;
    }

    /*
     * If y is zero, the hypotenuse is x.  This test saves a few cycles in
     * such cases, but more importantly it also protects against
     * divide-by-zero errors, since now x >= y.
     */
    if (y == 0.0)
        return x;

    /* Determine the hypotenuse */
    yx = y / x;
    return x * sqrt(1.0 + (yx * yx));
}


int main ()
{
        //fesetround(FE_TONEAREST);
        printf("fegetround is %d\n", fegetround());
        double r = pg_hypot(10.0, 10.0);
        printf("14 %.14g\n", r);
        printf("15 %.15g\n", r);
        printf("16 %.16g\n", r);
        printf("17 %.17g\n", r);
        return 0;
}


Jessie output:
fegetround is 0
14 14.142135623731
15 14.1421356237309
16 14.14213562373095
17 14.142135623730949

Sid output:
fegetround is 0
14 14.142135623731
15 14.142135623731
16 14.14213562373095
17 14.142135623730951


The Sid output is also observed when running the binary compiled on
Jessie on Sid, so it's a library issue, not a compiler/binary one.


The problem might be due to the fix for #843904.


FTBFS in postgresql-9.4 in jessie-pu:
https://buildd.debian.org/status/fetch.php?pkg=postgresql-9.4&arch=powerpc&ver=9.4.11-0%2Bdeb8u1&stamp=1487473754&raw=0
FTBFS in postgresql-9.6 in jessie-backports:
https://buildd.debian.org/status/fetch.php?pkg=postgresql-9.6&arch=powerpc&ver=9.6.1-2~bpo8%2B1&stamp=1485184696&raw=0

Thread on pgsql-hackers:
https://www.postgresql.org/message-id/20170220155819.m2s43pf2pvkes4pc%40msg.credativ.de

Christoph
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-postgresql-public/attachments/20170220/29c7938c/attachment.sig>


More information about the Pkg-postgresql-public mailing list