Package: linbox
Version: 1.3.2-1
Severity: serious
Tags: sid patch
Justification: FTBFS


In an attempt to build libqb on mips/mipsel, 
build failed on testing:


<  PASS: test-charpoly
<  make[5]: *** Deleting file `test-det.log'
<  make[5]: *** [test-det.log] Terminated
<  make: *** [build-arch] Terminated
<  E: Caught signal ‘Terminated’: terminating immediately
<  make[4]: *** [check-TESTS] Terminated
<  make[1]: *** [check-recursive] Terminated
<  make[2]: *** [check-recursive] Terminated
<  make[3]: *** [check-am] Terminated
<  Terminated
<  Build killed with signal TERM after 300 minutes of inactivity

The full build logs are available from:
https://buildd.debian.org/status/fetch.php?pkg=linbox&arch=mips&ver=1.3.2-1&stamp=1379576905

Test test-det on i386 or amd64 successfully pass after a few iterations,
on mips this test has an enormous number of iterations
and build of the linbox package on buildd breaks after 300 minutes of 
inactivity.

The reason for this behavior is that in:
linbox/algorithms/rational-reconstruction-base.h
the way to calculate RecCounter is:
<  RecCounter = (size_t)((double)log((double)rbound_)/log(2.));//2^RecCounter < 
rbound_ <=2^(RecCounter+1)
For rbound_ is equal to zero the result of log function is -inf (double[8 
bytes]).
When we cast -inf to size_t (unsigned int[4 bytes]) on i386 and amd64,
result is zero.
In the same situation on mips architecture, cast is done through
TRUNC.W.D instruction.
For this instraction, if the source value is Infinity, NaN, or rounds to an 
integer outside the range
-2^31 to 2^31-1, the result cannot be represented correctly and an IEEE Invalid 
Operation
condition exists. The result depends on the FP exception model currently active 
and the
default result is 2^31–1 (2147483647).


A patch fixing this issue is attached.
Author: "Dejan Latinovic" <dejan.latino...@rt-rk.com>
Description: Set RecCounter=0 if rbound_==0 to avoid cast of -inf.
Index: linbox-1.3.2/linbox/algorithms/rational-reconstruction-base.h
===================================================================
--- linbox-1.3.2.orig/linbox/algorithms/rational-reconstruction-base.h	2012-06-09 02:13:48.000000000 +0000
+++ linbox-1.3.2/linbox/algorithms/rational-reconstruction-base.h	2013-12-31 13:40:03.000000000 +0000
@@ -73,7 +73,8 @@
 				RecCounter = (int)sqrt((double)rbound_);//RecCounter^2 < rbound_ <=(RecCounter+1)^2
 			}
 			else if (_meth == GEOMETRIC) {
-				RecCounter = (size_t) log((double)rbound_) ;//2^RecCounter < rbound_ <=2^(RecCounter+1)
+				if (rbound_!=0)
+					RecCounter = (size_t) log((double)rbound_) ;//2^RecCounter < rbound_ <=2^(RecCounter+1)
 			}
 		}
 
@@ -85,7 +86,8 @@
 				RecCounter = (size_t)sqrt((double)rbound_);//RecCounter^2 < rbound_ <=(RecCounter+1)^2
 			}
 			else if (_meth == GEOMETRIC) {
-				RecCounter = (size_t)((double)log((double)rbound_)/log(2.));//2^RecCounter < rbound_ <=2^(RecCounter+1)
+				if (rbound_!=0)
+					RecCounter = (size_t)((double)log((double)rbound_)/log(2.));//2^RecCounter < rbound_ <=2^(RecCounter+1)
 			}
 
 		}

Reply via email to