[Debian-med-packaging] Bug#819617: bcftools: FTBFS: test suite fails on several architectures

Christian Seiler christian at iwakd.de
Sun May 29 11:42:44 UTC 2016


On Thu, 21 Jan 2016 22:29:16 -0500 "Aaron M. Ucko" <ucko at debian.org> wrote:
> * On i386 and kfreebsd-i386, 57 other test cases failed with output
>   differences (perhaps related to floating-point unit idiosyncracies --
>   it normally works with double-extended precision internally, rather
>   than rounding at every step).

I don't have anything to do with the package, but saw the bug
referenced on debian-release, and know a bit about the x86 FPU.
You can actually set the x86 FPU to use double precision internally
(80bit long double calculations will not work as expected then,
though, because the coprocessor will always truncate them to 64bit),
by using:

static void set_fpu_mode()
{
#ifdef __i386__
  unsigned short cw;
  asm volatile ("fnstcw %0" : "=m" (cw));
  cw = (cw & ~0x100) | 0x200;
  asm volatile ("fldcw %0" :: "m" (cw));
#endif
}

(double extended precision is 0x300, double is 0x200 and single
is 0x0, in case you want to change it back. There are other
settings in the control word, so I would recommend touching only
the bits 0x100 and 0x200.)

Other platforms (including x86_64) shouldn't have this trouble,
because even if they support other floating point types, operations
with the double data type are always done in double precision.

(Alternatively, you could use -msse2 as a compiler flag on new
enough x86_32 processors, the compiler would then use the SIMD
instructions instead of the older FPU, but that has the problem
that the code then won't run on older processors, which are still
supported in Debian at the moment.)

Hope that helps.

Regards,
Christian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/debian-med-packaging/attachments/20160529/fad1645a/attachment-0001.sig>


More information about the Debian-med-packaging mailing list