Skip Menu |

CC: jhi [...] iki.fi
Subject: Recent changes to blead cause t/op/sprintf2.t to fail on long doubles builds
Download (untitled) / with headers
text/plain 8.5k
Greetings! Somewhere in the following stack of commits to blead: commit be93048a43d87d317acca5b37619111b6a5f8c44 Author: Jarkko Hietaniemi <jhi@iki.fi> Date: Thu Aug 11 09:18:27 2016 -0400 [rt.perl.org #128893]: printf %a botches 0 flag for negative values commit 75326c485e9d40be5c22d508f581cdea68b244ce Author: Jarkko Hietaniemi <jhi@iki.fi> Date: Thu Aug 11 09:15:21 2016 -0400 [rt.perl.org #128890]: printf %a rounds incorrectly commit a9ce335538454d590920dab8d62db84948f1fb83 Author: Jarkko Hietaniemi <jhi@iki.fi> Date: Thu Aug 11 09:12:04 2016 -0400 [rt.perl.org #128889]: printf %a mishandles negative pseudo-precision (the fix for [rt.perl.org #128888] fixed also this one) commit 82229f9f47d9a169b59715582fb5a09b5a4ac0ff Author: Jarkko Hietaniemi <jhi@iki.fi> Date: Wed Aug 10 19:06:03 2016 -0400 [rt.perl.org #128888]: printf %a mishandles zero precision commit 520f3e58c346a7bc3ef0509dfe0db206dae454ee Author: Jarkko Hietaniemi <jhi@iki.fi> Date: Wed Aug 10 19:47:19 2016 -0400 Comment fix for b6d9b423 commit 94d00769fba240ffb86f18b3d66341fb1d24ae6c Author: Jarkko Hietaniemi <jhi@iki.fi> Date: Wed Aug 10 19:13:36 2016 -0400 Add rt.perl.org reference for b6d9b423 I began encountering the following test failures: dcollins@nightshade64:~/toolchain/buildbot/master/workers/bot1/linux-debug-thread-ld/build$ ./perl -Ilib t/harness t/op/sprintf2.t op/sprintf2.t .. 724/? # Failed test 1489 - at op/sprintf2.t line 807 # got "0x8.4p-3" # expected "0x1.08p+0" # Failed test 1490 - at op/sprintf2.t line 808 # got "0x8.4p-3" # expected "0x1.0p+0" # Failed test 1491 - [rt.perl.org \#128888] at op/sprintf2.t line 809 # got "0x8p-3" # expected "0x1p+0" # Failed test 1492 - [rt.perl.org \#128889] at op/sprintf2.t line 812 # got "0x8.4p-3" # expected "0x1.08p+0" # Failed test 1493 - at op/sprintf2.t line 815 # got "0x8.cp-3" # expected "0x1.18p+0" # Failed test 1494 - at op/sprintf2.t line 816 # got "0x8.4p-3" # expected "0x1.0p+0" # Failed test 1495 - [rt.perl.org \#128890] at op/sprintf2.t line 817 # got "0x8.cp-3" # expected "0x1.2p+0" # Failed test 1496 - at op/sprintf2.t line 818 # got "0x9.4p-3" # expected "0x1.2p+0" # Failed test 1497 - at op/sprintf2.t line 819 # got "0x9.cp-3" # expected "0x1.4p+0" # Failed test 1498 - at op/sprintf2.t line 820 # got "0xa.4p-3" # expected "0x1.4p+0" # Failed test 1499 - at op/sprintf2.t line 821 # got "0xa.cp-3" # expected "0x1.6p+0" # Failed test 1500 - at op/sprintf2.t line 822 # got "0xb.4p-3" # expected "0x1.6p+0" # Failed test 1501 - at op/sprintf2.t line 823 # got "0xb.cp-3" # expected "0x1.8p+0" # Failed test 1502 - at op/sprintf2.t line 824 # got "0xc.4p-3" # expected "0x1.8p+0" # Failed test 1503 - at op/sprintf2.t line 825 # got "0xc.cp-3" # expected "0x1.ap+0" # Failed test 1504 - at op/sprintf2.t line 826 # got "0xd.4p-3" # expected "0x1.ap+0" # Failed test 1505 - at op/sprintf2.t line 827 # got "0xd.cp-3" # expected "0x1.cp+0" # Failed test 1506 - at op/sprintf2.t line 828 # got "0xe.4p-3" # expected "0x1.cp+0" # Failed test 1507 - at op/sprintf2.t line 829 # got "0xe.cp-3" # expected "0x1.ep+0" # Failed test 1508 - at op/sprintf2.t line 830 # got "0xf.4p-3" # expected "0x1.ep+0" # Failed test 1509 - at op/sprintf2.t line 831 # got "0xf.cp-3" # expected "0x2.0p+0" # Failed test 1510 - at op/sprintf2.t line 833 # got "0x8.8p-3" # expected "0x1.1p+0" # Failed test 1511 - at op/sprintf2.t line 834 # got "0x8.cp-3" # expected "0x1.1p+0" # Failed test 1512 - at op/sprintf2.t line 835 # got "0x8.cp-3" # expected "0x1.2p+0" # Failed test 1513 - at op/sprintf2.t line 836 # got "0x9.0p-3" # expected "0x1.2p+0" # Failed test 1514 - at op/sprintf2.t line 838 # got "0x0.00p-3" # expected "0x2.00p+0" # Failed test 1515 - at op/sprintf2.t line 839 # got "0x0.00p+0" # expected "0x2.00p+3" # Failed test 1516 - at op/sprintf2.t line 842 # got "0x00000000000000cp-3" # expected "0x0000000000001.8p+0" # Failed test 1517 - [rt.perl.org \#128893] at op/sprintf2.t line 843 # got "-0x0000000000000cp-3" # expected "-0x000000000001.8p+0" # Failed test 1518 - [rt.perl.org \#128893] at op/sprintf2.t line 844 # got "+0x0000000000000cp-3" # expected "+0x000000000001.8p+0" # Failed test 1519 - [rt.perl.org \#128893] at op/sprintf2.t line 845 # got " 0x0000000000000cp-3" # expected " 0x000000000001.8p+0" # Failed test 1520 - at op/sprintf2.t line 846 # got " -0xcp-3" # expected " -0x1.8p+0" # Failed test 1521 - at op/sprintf2.t line 847 # got " +0xcp-3" # expected " +0x1.8p+0" # Failed test 1522 - at op/sprintf2.t line 848 # got " 0xcp-3" # expected " 0x1.8p+0" op/sprintf2.t .. Failed 34/1522 subtests (less 34 skipped subtests: 1454 okay) Test Summary Report ------------------- op/sprintf2.t (Wstat: 0 Tests: 1522 Failed: 34) Failed tests: 1489-1522 Files=1, Tests=1522, 1 wallclock secs ( 0.05 usr 0.01 sys + 0.04 cusr 0.04 csys = 0.14 CPU) Result: FAIL Under this configuration: dcollins@nightshade64:~/toolchain/buildbot/master/workers/bot1/linux-debug-thread-ld/build$ ./perl -Ilib -V Summary of my perl5 (revision 5 version 25 subversion 4) configuration: Derived from: be93048a43d87d317acca5b37619111b6a5f8c44 Platform: osname=linux osvers=4.6.0-1-amd64 archname=x86_64-linux-thread-multi-ld uname='linux nightshade64 4.6.0-1-amd64 #1 smp debian 4.6.1-1 (2016-06-06) x86_64 gnulinux ' config_args='-Dusedevel -des -Dcc=ccache gcc-6 -DDEBUGGING -Dusethreads -Duselongdouble' hint=recommended useposix=true d_sigaction=define useithreads=define usemultiplicity=define use64bitint=define use64bitall=define uselongdouble=define usemymalloc=n bincompat5005=undef Compiler: cc='ccache gcc-6' ccflags ='-D_REENTRANT -D_GNU_SOURCE -fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' optimize='-O2 -g' cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include' ccversion='' gccversion='6.1.1 20160519' gccosandvers='' intsize=4 longsize=8 ptrsize=8 doublesize=8 byteorder=12345678 doublekind=3 d_longlong=define longlongsize=8 d_longdbl=define longdblsize=16 longdblkind=3 ivtype='long' ivsize=8 nvtype='long double' nvsize=16 Off_t='off_t' lseeksize=8 alignbytes=16 prototype=define Linker and Libraries: ld='ccache gcc-6' ldflags =' -fstack-protector-strong -L/usr/local/lib' libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/6/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib libs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc libc=libc-2.22.so so=so useshrplib=false libperl=libperl.a gnulibc_version='2.22' Dynamic Linking: dlsrc=dl_dlopen.xs dlext=so d_dlsymun=undef ccdlflags='-Wl,-E' cccdlflags='-fPIC' lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector-strong' Characteristics of this binary (from libperl): Compile-time options: DEBUGGING HAS_TIMES MULTIPLICITY PERLIO_LAYERS PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP PERL_OP_PARENT PERL_PRESERVE_IVUV PERL_TRACK_MEMPOOL PERL_USE_DEVEL USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_LONG_DOUBLE USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API Locally applied patches: uncommitted-changes Built under linux Compiled at Jan 1 1970 00:00:00 %ENV: PERLBREW_BASHRC_VERSION="0.76" PERLBREW_HOME="/home/dcollins/.perlbrew" PERLBREW_ROOT="/home/dcollins/toolchain/perl5" @INC: lib /usr/local/lib/perl5/site_perl/5.25.4/x86_64-linux-thread-multi-ld /usr/local/lib/perl5/site_perl/5.25.4 /usr/local/lib/perl5/5.25.4/x86_64-linux-thread-multi-ld /usr/local/lib/perl5/5.25.4 . I don't have a long doubles smoker that doesn't also build with -DDEBUGGING and -Dusethreads, but I suspect that a build with -Duselongdoubles is sufficient to trigger this. Full build log here: http://73.193.221.114:8010/#/builders/15/builds/42 -- Respectfully, Dan Collins
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.4k
In fact, these test failures were added by several of those commits - they do not bisect cleanly. For example: 82229f9f47d9a169b59715582fb5a09b5a4ac0ff is the first bad commit commit 82229f9f47d9a169b59715582fb5a09b5a4ac0ff Author: Jarkko Hietaniemi <jhi@iki.fi> Date: Wed Aug 10 19:06:03 2016 -0400 [rt.perl.org #128888]: printf %a mishandles zero precision :100644 100644 93e6364071013469fde22fc001170da29bff9cc9 ac41af27dfe9035a46244a1b6d15830aa8de2c9c M sv.c :040000 040000 0c3aae5a15ebe25f4e05ac42751605f417088df0 388c66cd3f2e52ddb982e51d1f92d760483b3db3 M t adds these: op/sprintf2.t .. 1/? # Failed test 1489 - at op/sprintf2.t line 807 # got "0x8.4p-3" # expected "0x1.08p+0" # Failed test 1490 - at op/sprintf2.t line 808 # got "0x8.4p-3" # expected "0x1.0p+0" # Failed test 1491 - [rt.perl.org \#128888] at op/sprintf2.t line 809 # got "0x8p-3" # expected "0x1p+0" op/sprintf2.t .. Failed 3/1491 subtests (less 34 skipped subtests: 1454 okay) Test Summary Report ------------------- op/sprintf2.t (Wstat: 0 Tests: 1491 Failed: 3) Failed tests: 1489-1491 Files=1, Tests=1491, 0 wallclock secs ( 0.05 usr 0.00 sys + 0.06 cusr 0.18 csys = 0.29 CPU) Result: FAIL But more failing tests are added over the next few commits. If I understand the original bugs correctly, I think the issue was fixed for normal builds, but your tests have uncovered that the same problem still exists for long doubles. -- Respectfully, Dan Collins
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 200b
I forgot to add: the following configure flags are sufficient to trigger this bug: ./Configure -Dusedevel -Dcc='ccache gcc-6' -Duselongdouble -des && make -j4 test_prep -- Respectfully, Dan Collins
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 703b
Show quoted text
> But more failing tests are added over the next few commits. If I > understand the original bugs correctly, I think the issue was fixed > for normal builds, but your tests have uncovered that the same problem > still exists for long doubles.
Not quite. The failures you are seeing are caused by your long doubles (x86 80-bit) being scaled differently: perl -wle 'printf "%a\n", -1.5' # IEEE 754 64-bit -0xcp-3 perl -wle 'printf "%a\n", -1.5' # x86 80-bit -0x1.8+0 In any system: perl -wle 'print -0x1.8p+0' -1.5 perl -wle 'print -0xcp-3' -1.5 I'll extend the block that limits the testing only for the expected systems, sorry about not catching that earlier.
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 433b
On Thu Aug 11 11:31:02 2016, dcollinsn@gmail.com wrote: Show quoted text
> I forgot to add: the following configure flags are sufficient to > trigger this bug: > > ./Configure -Dusedevel -Dcc='ccache gcc-6' -Duselongdouble -des && > make -j4 test_prep
The -Dcc='ccache gcc-6' is not necessary, either. I triggered failures with simply '-des -Dusedevel -Duselongdouble'. See attachments. Thank you very much. -- James E Keenan (jkeenan@cpan.org)
Subject: longdouble.sprintf2.failures.txt

Message body is not shown because it is too large.

Subject: perl_V_longdouble.txt
Summary of my perl5 (revision 5 version 25 subversion 4) configuration: Commit id: 80a17ed4419aec102f46b22ce5ba9e9e074deffc Platform: osname=linux osvers=4.4.0-34-generic archname=x86_64-linux-ld uname='linux zareason 4.4.0-34-generic #53-ubuntu smp wed jul 27 16:06:39 utc 2016 x86_64 x86_64 x86_64 gnulinux ' config_args='-des -Dusedevel -Duselongdouble' hint=recommended useposix=true d_sigaction=define useithreads=undef usemultiplicity=undef use64bitint=define use64bitall=define uselongdouble=define usemymalloc=n bincompat5005=undef Compiler: cc='cc' ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' optimize='-O2' cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include' ccversion='' gccversion='5.4.0 20160609' gccosandvers='' intsize=4 longsize=8 ptrsize=8 doublesize=8 byteorder=12345678 doublekind=3 d_longlong=define longlongsize=8 d_longdbl=define longdblsize=16 longdblkind=3 ivtype='long' ivsize=8 nvtype='long double' nvsize=16 Off_t='off_t' lseeksize=8 alignbytes=16 prototype=define Linker and Libraries: ld='cc' ldflags =' -fstack-protector-strong -L/usr/local/lib' libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /lib64 /usr/lib64 libs=-lpthread -lnsl -ldb -ldl -lm -lcrypt -lutil -lc perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc libc=libc-2.23.so so=so useshrplib=false libperl=libperl.a gnulibc_version='2.23' Dynamic Linking: dlsrc=dl_dlopen.xs dlext=so d_dlsymun=undef ccdlflags='-Wl,-E' cccdlflags='-fPIC' lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP PERL_OP_PARENT PERL_PRESERVE_IVUV PERL_USE_DEVEL USE_64_BIT_ALL USE_64_BIT_INT USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_LONG_DOUBLE USE_PERLIO USE_PERL_ATOF Built under linux Compiled at Aug 11 2016 21:00:53 %ENV: PERLBREW_BASHRC_VERSION="0.67" PERLBREW_HOME="/home/jkeenan/.perlbrew" PERLBREW_MANPATH="/home/jkeenan/perl5/perlbrew/perls/perl-5.24.0/man" PERLBREW_PATH="/home/jkeenan/perl5/perlbrew/bin:/home/jkeenan/perl5/perlbrew/perls/perl-5.24.0/bin" PERLBREW_PERL="perl-5.24.0" PERLBREW_ROOT="/home/jkeenan/perl5/perlbrew" PERLBREW_VERSION="0.67" PERL_WORKDIR="gitwork/perl" @INC: lib /usr/local/lib/perl5/site_perl/5.25.4/x86_64-linux-ld /usr/local/lib/perl5/site_perl/5.25.4 /usr/local/lib/perl5/5.25.4/x86_64-linux-ld /usr/local/lib/perl5/5.25.4 .
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 399b
Show quoted text
> Not quite. The failures you are seeing are caused by your long > doubles (x86 80-bit) being scaled differently: > > perl -wle 'printf "%a\n", -1.5' # IEEE 754 64-bit > -0xcp-3 > perl -wle 'printf "%a\n", -1.5' # x86 80-bit > -0x1.8+0
Duh. Got the comments the wrong way round. perl -wle 'printf "%a\n", -1.5' # x86 80-bit -0xcp-3 perl -wle 'printf "%a\n", -1.5' # IEEE 754 64-bit -0x1.8+0
Subject: Re: [perl #128899] printf %a mishandles several edge cases on long doubles
To: perl5-porters [...] perl.org
From: Zefram <zefram [...] fysh.org>
Date: Fri, 12 Aug 2016 12:41:31 +0100
Download (untitled) / with headers
text/plain 860b
Jarkko Hietaniemi via RT wrote: Show quoted text
>Not quite. The failures you are seeing are caused by your long doubles (x86 80-bit) being scaled differently:
This different scaling is seen on any long-double build, consistently since %a support was added. It's obviously based on arranging for the significand to end in the low-order bit of a hex digit, rather than arranging for the integer part of a normalised significand to always be 1. This is legal per the C spec, and glibc does the same. This behaviour minimises the number of required digits, and aligns the digits with the bitwise structure of the long double type. The other behaviour better matches the numerical structure. I think the other behaviour would be better, but this behaviour isn't a bug. The tests failing is a bug. The tests obviously need to allow for the variation in behaviour. -zefram
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 956b
Show quoted text
> doubles (x86 80-bit) being scaled differently: > > This different scaling is seen on any long-double build, consistently > since %a support was added.
... consistent with how the said platforms' libcs do it. Not just glibc. Show quoted text
> It's obviously based on arranging for > the significand to end in the low-order bit of a hex digit, rather > than > arranging for the integer part of a normalised significand to always > be 1. > This is legal per the C spec, and glibc does the same. This behaviour > minimises the number of required digits, and aligns the digits with > the > bitwise structure of the long double type. The other behaviour better > matches the numerical structure. I think the other behaviour would be > better, but this behaviour isn't a bug. > > The tests failing is a bug. The tests obviously need to allow for the > variation in behaviour.
I disagree with your use of the word since this is a platform difference, but whatever.
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 106b
Subject: Re: [perl #128899] printf %a mishandles several edge cases on long doubles
From: Zefram <zefram [...] fysh.org>
Date: Sat, 2 Dec 2017 23:34:37 +0000
To: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 137b
This ticket was fixed the day it was raised, in commit 749d85343f3cdb65891a5fe3b9f55ef3a5b03ca8. The ticket can be closed now. -zefram


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org