Subject: | Test failure on several architectures (64-bit problems) |
Hi,
as seen in Debian bug #462249 <http://bugs.debian.org/462249>, we are
seeing test failures on several 32-bit architectures with Perl 5.8.8 and
libFLAC 1.2.1.
I have been able to reproduce this on hppa, and the test failure is due
to differing cuesheet information. I get
Show quoted text
> REM FLAC__lead-in 1604068
> REM FLAC__lead-out 170 153200460
>
> where it's supposed to be
>
> REM FLAC__lead-in 88200
> REM FLAC__lead-out 170 153200460
The problem seems to be the newSVpvf() calls around Header.xs:250 - they
are using the "UVuf" format, which expands at least here to "lu"
(/usr/lib/perl/5.8/CORE/Config.h), while passing in a FLAC__int64 value.
This means that the newSVpvf() stdarg function is expecting an "unsigned
long" (32 bits) and getting an "unsigned long long" (64 bits).
I don't claim to understand exactly what happens here; I suppose the
behaviour is undefined, and apparently the caller and the callee are
disagreeing about the register where the value should be stored. The
wrong value (1604068 above) varies a bit, and seems to be whatever
happens to be in r25 just before the function call.
One fix is to explicitly cast the value to "unsigned long" in the
newSVpvf() calls, but I guess this would lose information on >4G (32
bits) FLAC files. A better solution might be to do the decimal
conversion on the C side with sprintf() and the "%llu" format before
calling newSV*().
Note that this presumably applies to all the three places in Header.xs
which use the "UVuf" format; we're seeing test failures with both the
lead-in and the lead-out values on mips.
Please let me know if I can help you in any way in fixing this.
Thanks for your work on Audio-FLAC-Header,
--
Niko Tyni (Debian Perl Group)
ntyni@debian.org