Bug#916504: pulseaudio FTBFS on Alpha; return of the volume-test failure

2019-01-15 Thread Felipe Sateler
Control: forwarded -1
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/619
Control: retitle -1 pulseaudio: uses -ffinite-math but might deal with
infinity

Hi,

Sorry for the delay.

On Sat, Dec 15, 2018 at 3:24 AM Michael Cree  wrote:

> Source: pulseaudio
> Version: 12.2-2
> Severity: important
> Justification: fails to build from source but built in the past.
> User: debian-al...@lists.debian.org
> Usertags: alpha
> Tags: patch
>
> Pulseaudio FTBFS on alpha due to the volume-test test failing due to
> a floating-point exception which in turn is due to an infinity in
> floating-point calculations when volume-test is compiled with finite
> math options.
>
> This is bug #798248 reappearing but in a subtlely different guise.
> There the non-finite math was protected against by checking that the
> arguments are finite before performing floating point calculations,
> but it now seems that gcc takes the specification of finite math,
> being "[a]llow optimizations for floating-point arithmetic that
> assume that arguments and results are not NaNs or +-Infs" so
> pedantically true, that it is fair game to optimise away any calls
> to isfinite() because the argument must be finite: it was said so
> on the command line!
>
> Whatever, examination of the object code shows that the calls to
> isfinite() are eliminated thus the floating-point arithmetic is no
> longer protected.
>

I think if infinities might happen, then using -ffinite-math is wrong.

I have forwarded the issue upstream. I have disabled -ffast-math in the
meantime, since I think correctness is more important than speed.


>
> Fortunately we can work out whether the arguments to the offending
> arithmetic are finite by other means and I attach a patch doing
> just that.  With this patch pulseaudio builds to completion on
> Alpha.
>

This is insufficient as there is a call to isnan() in the core lib.
-- 

Saludos,
Felipe Sateler


Bug#916504: pulseaudio FTBFS on Alpha; return of the volume-test failure

2018-12-14 Thread Michael Cree
Source: pulseaudio
Version: 12.2-2
Severity: important
Justification: fails to build from source but built in the past.
User: debian-al...@lists.debian.org
Usertags: alpha
Tags: patch

Pulseaudio FTBFS on alpha due to the volume-test test failing due to
a floating-point exception which in turn is due to an infinity in
floating-point calculations when volume-test is compiled with finite
math options.

This is bug #798248 reappearing but in a subtlely different guise.
There the non-finite math was protected against by checking that the
arguments are finite before performing floating point calculations,
but it now seems that gcc takes the specification of finite math,
being "[a]llow optimizations for floating-point arithmetic that
assume that arguments and results are not NaNs or +-Infs" so
pedantically true, that it is fair game to optimise away any calls
to isfinite() because the argument must be finite: it was said so
on the command line!

Whatever, examination of the object code shows that the calls to
isfinite() are eliminated thus the floating-point arithmetic is no
longer protected.

Fortunately we can work out whether the arguments to the offending
arithmetic are finite by other means and I attach a patch doing
just that.  With this patch pulseaudio builds to completion on
Alpha.

Cheers,
Michael.
Index: pulseaudio-12.2/src/tests/volume-test.c
===
--- pulseaudio-12.2.orig/src/tests/volume-test.c	2018-12-15 14:29:34.0 +1300
+++ pulseaudio-12.2/src/tests/volume-test.c	2018-12-15 16:24:38.303993387 +1300
@@ -114,7 +114,7 @@
 double q, qq;
 
 p = pa_sw_volume_multiply(v, w);
-if (isfinite(db) && isfinite(db2))
+	if (v && w)
 qq = db + db2;
 else
 qq = -INFINITY;