mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-12 13:30:10 -05:00
building PA with -O0 leads to test failure in mix-test on i386 issue reported by Felipe, see http://lists.freedesktop.org/archives/pulseaudio-discuss/2014-August/021406.html the problem is the value 0xbeffbd7f: when byte-swapped it becomes 0x7fbdffbe and according to IEEE-754 represents a signalling NaN (starting with s111 1111 10, see http://en.wikipedia.org/wiki/NaN) when this value is assigned to a floating point register, it becomes 0x7ffdffbe, representing a quiet NaN (starting with s111 1111 11) -- a signalling NaN is turned into a quiet NaN! so PA_FLOAT32_SWAP(PA_FLOAT32_SWAP(x)) != x for certain values, uhuh! the following test code can be used; due to volatile, it will always demonstrate the issue; without volatile, it depends on the optimization level (i386, 32-bit, gcc 4.9): // snip static inline float PA_FLOAT32_SWAP(float x) { union { float f; uint32_t u; } t; t.f = x; t.u = bswap_32(t.u); return t.f; } int main() { unsigned x = 0xbeffbd7f; volatile float f = PA_FLOAT32_SWAP(*(float *)&x); printf("%08x %08x %08x %f\n", 0xbeffbd7f, *(unsigned *)&f, bswap_32(*(unsigned *)&f), f); } // snip the problem goes away with optimization when no temporary floating point registers are used the proposed solution is to avoid passing swapped floating point data in a float; this is done with new functions PA_READ_FLOAT32RE() and PA_WRITE_FLOAT32RE() which use uint32_t to dereference a pointer and byte-swap the data, hence no temporary float variable is used also delete PA_FLOAT32_TO_LE()/_BE(), not used Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Reported-by: Felipe Sateler <fsateler@debian.org> |
||
|---|---|---|
| .. | ||
| alsa-mixer-path-test.c | ||
| alsa-time-test.c | ||
| asyncmsgq-test.c | ||
| asyncq-test.c | ||
| channelmap-test.c | ||
| close-test.c | ||
| connect-stress.c | ||
| cpu-test.c | ||
| cpulimit-test.c | ||
| extended-test.c | ||
| flist-test.c | ||
| format-test.c | ||
| get-binary-name-test.c | ||
| gtk-test.c | ||
| hook-list-test.c | ||
| interpol-test.c | ||
| ipacl-test.c | ||
| ladspa-dbus.py | ||
| lo-latency-test.c | ||
| lo-test-util.c | ||
| lo-test-util.h | ||
| lock-autospawn-test.c | ||
| mainloop-test.c | ||
| Makefile | ||
| mcalign-test.c | ||
| memblock-test.c | ||
| memblockq-test.c | ||
| mix-special-test.c | ||
| mix-test.c | ||
| mult-s16-test.c | ||
| once-test.c | ||
| pacat-simple.c | ||
| parec-simple.c | ||
| proplist-test.c | ||
| queue-test.c | ||
| remix-test.c | ||
| resampler-test.c | ||
| rtpoll-test.c | ||
| rtstutter.c | ||
| runtime-test-util.h | ||
| sig2str-test.c | ||
| sigbus-test.c | ||
| smoother-test.c | ||
| srbchannel-test.c | ||
| stripnul.c | ||
| strlist-test.c | ||
| sync-playback.c | ||
| test-daemon.sh | ||
| thread-mainloop-test.c | ||
| thread-test.c | ||
| usergroup-test.c | ||
| utf8-test.c | ||
| volume-test.c | ||
| volume-ui.py | ||