#800840 ecasound FTBFS on Alpha: use of infinities despite compilation with -ffast-math

Package:
src:ecasound
Source:
ecasound
Submitter:
Michael Cree
Date:
2021-04-27 11:15:02 UTC
Severity:
important
Tags:
#800840#5
Date:
2015-10-04 09:14:51 UTC
From:
To:
Ecasound FTBFS on Alpha due to a test-suite failure [1]:

make  check-TESTS
make[5]: Entering directory '/«PKGBUILDDIR»/libecasound'
make[6]: Entering directory '/«PKGBUILDDIR»/libecasound'
../test-driver: line 107: 22820 Floating point exception"$@" > $log_file 2>&1
FAIL: libecasound_tester

Running the test suite under gdb reveals the place of the floating
point exception to be:

#0  0x0000000120114d30 in GENERIC_OSCILLATOR::set_parameter (this=0x12022ec10,
    param=<optimized out>, value=0) at osc-gen.cpp:208

which is on the line of code:

loop_length_rep = 1.0f / frequency();

i.e., a division by frequency() after setting frequency to zero, thus
a division by zero.  But ecasound is compiled with -ffast-math, which
according to the gcc manual in turn sets -ffinite-math-only which is
a guarantee to the compiler that all floating point calculations are
finite.  On Alpha abusing that guarantee results in a floating point
exception and program termination.

Assuming it is intended that frequencies can be zero I attach a patch
that protects against the division by zero.  With that ecasound builds
to completion on Alpha.

(In the patch I also assume that frequencies are non-negative thus
there is no possibility of -0.0 as a frequency.)

Cheers
Michael.

[1] https://buildd.debian.org/status/fetch.php?pkg=ecasound&arch=alpha&ver=2.9.1-7&stamp=1440432975