[PPL-devel] Big Endian Regression Test Failures

Roberto Bagnara bagnara at cs.unipr.it
Sat Aug 18 15:03:43 CEST 2012


On 08/18/12 14:37, Edd Barrett wrote:
> On Fri, Aug 17, 2012 at 12:39:30PM +0100, Edd Barrett wrote:
>> Hi,
>>
>> I have (slowly) been packaging PPL for OpenBSD. I mostly have amd64/i386
>> build+regressions sorted with c,c++,java,ocaml interfaces enabled
>> (swi-prolog on the todo list). We tend to test things on big endian
>> machines, as they find all kinds of bugs. Anything that uses OCaml is
>> especially tested on sparc64, as there is no native code backend for
>> this architecture.
>>
>> Attached is a gzipped regression test log on a sparc64 machine with
>> PPL_NOISY_TESTS=yes set. A few tests failed. This build was for PPL-1.0
>> with the C,C++ and Ocaml interfaces enabled (Java could not be included
>> as openjdk only runs on i386 and amd64 on OpenBSD).
>>
>> Meanwhile, I will checkout the latest development code and see if
>> anything changes.
>
> Attached are the regression test failures using PPL master on sparc64.

Hi Edd.

These have the same cause we already discussed (already reported
and fixed upstream by Matthew Dempsky <matthew at dempsky.org>).
Perhaps you mean you are testing with the fixed version of libstdc++?
Kind regards,

    Roberto


On 07/17/12 19:04, Roberto Bagnara wrote:> On 07/16/12 17:48, Abramo Bagnara wrote:
 > It is indeed a bogus version of libstdc++ to cause the problem.
 > Here is what happens (experiments repeated with identical results
 > with OpenBSD 5.1 both on x86_64 and sparc64):
 >
 > -bash-4.2$ cat bug.cc
 > #include <cmath>
 > #include <cstdlib>
 > #include <cstdio>
 >
 > int main(int argc, char **argv) {
 >    long double x = strtold(argv[1], 0);
 >    long double y = std::floor(x);
 >    printf("%.1000Lg\n%.1000Lg\n", x, y);
 > }
 > -bash-4.2$ g++ bug.cc
 > -bash-4.2$ ./a.out  13311002825915415087
 > 13311002825915415087
 > 13311002825915414528
 > -bash-4.2$
 >
 > As you can see, std::floor(x) returns a wrong result.
 > An equivalent C program does the right thing:
 >
 > -bash-4.2$ cat bug.c
 > #include <math.h>
 > #include <stdlib.h>
 > #include <stdio.h>
 >
 > int main(int argc, char **argv) {
 >    long double x = strtold(argv[1], 0);
 >    long double y = floorl(x);
 >    printf("%.1000Lg\n%.1000Lg\n", x, y);
 > }
 > -bash-4.2$ gcc bug.c -lm
 > -bash-4.2$ ./a.out  13311002825915415087
 > 13311002825915415087
 > 13311002825915415087
 > -bash-4.2$
 >
 > But not if it is linked with -lstdc++ instead of -lm:
 >
 > -bash-4.2$ gcc bug.c -lstdc++
 > -bash-4.2$ ./a.out  13311002825915415087
 > 13311002825915415087
 > 13311002825915414528
 > -bash-4.2$
 >
 > The reason why libstdc++ on OpenBSD exports a
 > bogus version of floorl() probably lies with the
 > following piece of code:
 >
 > #ifndef HAVE_FLOORL
 > long double
 > floorl(long double x)
 > {
 >    return floor((double) x);
 > }
 > #endif
 >
 > We have no idea why on OpenBSD libstdc++ is compiled
 > with HAVE_FLOORL not defined.
 > Kind regards,
 >
 >      Roberto
 >


-- 
Prof. Roberto Bagnara
Applied Formal Methods Laboratory
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it
-- 
Prof. Roberto Bagnara
Applied Formal Methods Laboratory
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it



More information about the PPL-devel mailing list