Bug#362414: abs() returns a negative number
Package: gcc-snapshot
Version: 20060325-1
I get the following build failure of libsndfile with gcc 4.2
20060325-1 and 20060408-1. Basically what happens is that abs()
returns a negative number.
> Automatic build of libsndfile_1.0.15-2 on em64t by sbuild/amd64 1.112
...
> ./lossy_comp_test wav_ima
> lcomp_test_short : ima.wav ................. ok
> lcomp_test_int : ima.wav .................
>
> Line 757: Signal is all zeros (-27260928, 0xFE600800).
> make[2]: *** [wav-tests] Error 1
The code basically does:
sum_abs = abs (sum_abs + abs (abs (data [k]) - 256)) ;
in a loop.
With 4.2 snapshot I get negative numbers at some point, but with
4.0/4.1 I don't:
--- 1 2006-04-13 10:38:23.000000000 +0000
+++ 2 2006-04-13 10:39:39.000000000 +0000
@@ -110,6 +110,6 @@
1930663680 (data[k] = 72744960)
2009241088 (data[k] = 78577664)
2083755264 (data[k] = 74514432)
--2131848192 (data[k] = 79364096)
--2056350976 (data[k] = 75497472)
+2131848192 (data[k] = 79364096)
+2087621888 (data[k] = 75497472)
...
Unfortunataly, a simple test case which adds those numbers works, and
I have no idea how to produce a test case. This bug seems different
to the other bug about signedness we just reported (PR27116) since no
division is involved here.
--
Martin Michlmayr
http://www.cyrius.com/
Reply to: