Source: ecasound
Version: 2.9.1-7
Severity: important
Justification: fails to build from source but built in the past
User: debian-al...@lists.debian.org
Usertags: ftbfs

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
Index: ecasound-2.9.1/libecasound/osc-gen.cpp
===================================================================
--- ecasound-2.9.1.orig/libecasound/osc-gen.cpp
+++ ecasound-2.9.1/libecasound/osc-gen.cpp
@@ -205,7 +205,10 @@ void GENERIC_OSCILLATOR::set_parameter(i
   switch (param) {
   case 1: 
     frequency(value);
-    loop_length_rep = 1.0f / frequency(); // length of one wave in seconds
+    if (frequency() == 0.0)
+      loop_length_rep = INFINITY;           // Protect against div by zero
+    else
+      loop_length_rep = 1.0f / frequency(); // length of one wave in seconds
     break;
 
   case 2: 

Reply via email to