[erlang-questions] Testing reliable floating points exeption fails on x86?

Sergei Golovan <>
Wed Sep 19 14:50:51 CEST 2007


On 9/19/07, Mikael Pettersson <> wrote:
> On Wed, 19 Sep 2007 15:29:28 +0400, Sergei Golovan wrote:
> > Could someone explain me what 'reliable floating points exceptions'
> > are and how their reliability is checked?
>
> The ability to program the FPU so that e.g. overflows are reported
> as signals instead of as +inf.

OK, I see.

>
> > I'm packaging erlang/OTP for Debian GNU/Linux using two erlang
> > flavours: with and without HiPE (HiPE enabled architectures are i386
> > (x86), amd64 (x86_64), powerpc and sparc). If I understand correctly,
> > HiPE refuses to build if floating points exceptions are unreliable.
>
> Correct for x86-32, x86-64, ppc32, and sparc32.
> HiPE doesn't require FP exceptions on ARMv5b.

But what may cause FP exceptions to be unreliable? Do they require
some special support in Linux kernel for example, or if it's Linux 2.6
than they must be reliable? Or it depends on a user hardware (in this
case we probably should disable FP exceptions in non-HiPE package,
because in Debian we use binary packages which should work for
anyone)?

>
> > I built erlang on x86 architecture many times and test for reliable fp
> > exceptions never failed. But recently I've got a bugreport
> > (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=442965) where the
> > test fails.
> >
> > 1) Could it be that the test fails due to false negative (probably
> > because it was run on x86_64 hardware, though I never managed to get
> > it failed using both 32-bit and 64-bit kernel with 32-bit userland)?
>
> There's no information in that Debian bug report apart from "it failed".
> Most likely a compile-time error is causing fpe-test.c to fail.

Unfortunately, the reporter didn't get any additional info. I'll
certainly ask him.

>
> FWIW, the HiPE group regularly does builds on Fedora-based x86-{32,64}
> boxes without problems.

I rebuild erlang with and without HiPE very often (on amd64, usually
with 32-bit kernel), and never get it failed (excepting my own bugs in
a build script).

>
> > 2) I'm tempted to disable this test in a Debian source package and
> > undefine NO_FPE_SIGNALS only for 4 architectures mentioned above. Will
> > this cause any harm if erlang is built without HiPE support (for those
> > 4 arches there are two erts - with and without HiPE and users select
> > which to use)? Or fp exceptions play certain role even in this case?
>
> Floating-point arithmetic in the base BEAM system will be slower
> if FP exceptions don't work.

I've found references to NO_FPE_SIGNALS macro in erl_interface. Should
it matter if an application will use erl_interface built without using
FP and run on erlang with FP (and vice versa)?

>
> The real solution is to debug the fpe-test.c failure on the
> bug reporter's machine.

Yes, it's definitely the best direction to go.

Cheers!
-- 
Sergei Golovan



More information about the erlang-questions mailing list