Skip Menu |
Report information
Id: 125203
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: bulk88 <bulk88 [at] hotmail.com>
Cc:
AdminCc:

Operating System: mswin32
PatchStatus: (no value)
Severity: medium
Type: core
Perl Version: 5.22.0
Fixed In: (no value)



Subject: "pack f NaN not-equals NaN" fails in t/op/infnan.t on VC6
Date: Fri, 15 May 2015 22:16:29 -0400
From: bulk88 <bulk88 [...] hotmail.com>
To: perlbug [...] perl.org
Download (untitled) / with headers
text/plain 6.2k
This is a bug report for perl from bulk88@hotmail.com, generated with the help of perlbug 1.40 running under perl 5.22.0. ----------------------------------------------------------------- [Please describe your issue here] Blead is failing with VC6, my first time testing it in a few months. IDK if this ticket is a blocker. ------------------------------------------------------------------------------------ Test Summary Report ------------------- op/infnan.t (Wstat: 0 Tests: 652 Failed: 1) Failed test: 420 Files=2384, Tests=696398, 1416 wallclock secs (66.97 usr + 2.17 sys = 69.14 CPU ) Result: FAIL b88dmake: Error code 129, while making 'test' ------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------ ok 408 - NaN pack w fails ok 409 - pack w stringy NaN undef ok 410 - stringy NaN pack w fails ok 411 - pack W NaN undef ok 412 - NaN pack W fails ok 413 - pack W stringy NaN undef ok 414 - stringy NaN pack W fails ok 415 - pack U NaN undef ok 416 - NaN pack U fails ok 417 - pack U stringy NaN undef ok 418 - stringy NaN pack U fails ok 419 - pack f NaN defined not ok 420 - pack f NaN not-equals NaN ok 421 - pack d NaN defined ok 422 - pack d NaN not-equals NaN ok 423 - pack F NaN defined ok 424 - pack F NaN not-equals NaN ok 425 - pack a4 NaN defined ok 426 - pack a4 NaN same as 'NaN' ok 427 - pack A4 NaN defined ok 428 - pack A4 NaN same as 'NaN' ok 429 - pack Z5 NaN defined ok 430 - pack Z5 NaN same as 'NaN' ok 431 - pack b20 NaN defined ------------------------------------------------------------------------------------ adding some debugging info, test numbers are different because I deleted other tests ------------------------------------------------------------------------------------ warn "start block"; for my $f (@packf_fmt) { ok(defined eval { $a = pack($f, $NaN) }, "pack $f NaN defined"); warn "dumping \$a\n"; Dump($a); eval { $b = unpack($f, $a) }; warn "dumping \$b\n"; Dump($b); cmp_ok($b, '!=', $b, "pack $f NaN not-equals $NaN"); } ------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------ start block at t/op/infnan.t line 314. ok 395 - pack f NaN defined dumping $a SV = PV(0xa33f3c) at 0x9f77c4 REFCNT = 1 FLAGS = (POK,pPOK) PV = 0xa53e84 "\0\0\200\377"\0 CUR = 4 LEN = 12 dumping $b SV = NV(0x90ab74) at 0xa01874 REFCNT = 1 FLAGS = (NOK,pNOK) NV = -Inf not ok 396 - pack f NaN not-equals NaN # Failed test 396 - pack f NaN not-equals NaN at t/op/infnan.t line 323 # got "-Inf" # expected != "-Inf" # -Inf - -Inf = NaN ok 397 - pack d NaN defined dumping $a SV = PV(0xa33f3c) at 0x9f77c4 REFCNT = 1 FLAGS = (POK,IsCOW,pPOK) PV = 0xa53e84 "\0\0\0\0\0\0\370\177"\0 CUR = 8 LEN = 12 COW_REFCNT = 0 dumping $b SV = NV(0x90ab74) at 0xa01874 REFCNT = 1 FLAGS = (NOK,pNOK) NV = NaN ok 398 - pack d NaN not-equals NaN ok 399 - pack F NaN defined dumping $a SV = PV(0xa33f3c) at 0x9f77c4 REFCNT = 1 FLAGS = (POK,IsCOW,pPOK) PV = 0xa53e84 "\0\0\0\0\0\0\370\177"\0 CUR = 8 LEN = 12 COW_REFCNT = 0 dumping $b SV = NV(0x90ab74) at 0xa01874 REFCNT = 1 FLAGS = (NOK,pNOK) NV = NaN ok 400 - pack F NaN not-equals NaN ------------------------------------------------------------------------------------ [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=core severity=medium --- Site configuration information for perl 5.22.0: Configured by Owner at Fri May 15 15:46:11 2015. Summary of my perl5 (revision 5 version 22 subversion 0) configuration: Platform: osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -GF -W3 -O1 -MD -Zi -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -D_USE_32BIT_TIME_T', optimize='-O1 -MD -Zi -DNDEBUG', cppflags='-DWIN32' ccversion='12.00.8168', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234, doublekind=3 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8, longdblkind=0 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -libpath:"c:\perl\lib\CORE" -machine:x86' libpth=\lib libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl522.lib gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -libpath:"c:\perl\lib\CORE" -machine:x86' Locally applied patches: RC0 --- @INC for perl 5.22.0: C:/perl521/vc6src/lib . --- Environment for perl 5.22.0: HOME (unset) LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=C:\sperl\c\bin;C:\WINDOWS\system32;C:\PROGRA~1\MIAF9D~1\Common6\msdev98\BIN;C:\PROGRA~1\MIAF9D~1\VC98\BIN;C:\PROGRA~1\MIAF9D~1\Common6\TOOLS\WINNT;C:\PROGRA~1\MIAF9D~1\Common6\TOOLS;C:\WINDOWS;C:\Program Files\Git\cmd; PERL_BADLANG (unset) PERL_JSON_BACKEND=Cpanel::JSON::XS PERL_YAML_BACKEND=YAML SHELL (unset)
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 2.7k
Same modified infnan.t on VC7 ------------------------------------------------------- start block at t/op/infnan.t line 314. ok 395 - pack f NaN defined dumping $a SV = PV(0xa34fdc) at 0x9f77ac REFCNT = 1 FLAGS = (POK,pPOK) PV = 0xa2b2f4 "\0\0\300\177"\0 CUR = 4 LEN = 12 dumping $b SV = NV(0x90ab7c) at 0xa0231c REFCNT = 1 FLAGS = (NOK,pNOK) NV = NaN ok 396 - pack f NaN not-equals NaN ok 397 - pack d NaN defined dumping $a SV = PV(0xa34fdc) at 0x9f77ac REFCNT = 1 FLAGS = (POK,IsCOW,pPOK) PV = 0xa2b2f4 "\0\0\0\0\0\0\370\177"\0 CUR = 8 LEN = 12 COW_REFCNT = 0 dumping $b SV = NV(0x90ab7c) at 0xa0231c REFCNT = 1 FLAGS = (NOK,pNOK) NV = NaN ok 398 - pack d NaN not-equals NaN ok 399 - pack F NaN defined dumping $a SV = PV(0xa34fdc) at 0x9f77ac REFCNT = 1 FLAGS = (POK,IsCOW,pPOK) PV = 0xa2b2f4 "\0\0\0\0\0\0\370\177"\0 CUR = 8 LEN = 12 COW_REFCNT = 0 dumping $b SV = NV(0x90ab7c) at 0xa0231c REFCNT = 1 FLAGS = (NOK,pNOK) NV = NaN ok 400 - pack F NaN not-equals NaN ------------------------------------------------------- Now a diff between vc6 (failing) and vc7 (passing) ------------------------------------------------------- --- C:\perl521\vc6src\vc6.txt +++ C:\perl521\vc6src\vc7.txt @@ -1,48 +1,44 @@ start block at t/op/infnan.t line 314. ok 395 - pack f NaN defined dumping $a -SV = PV(0xa33f3c) at 0x9f77c4 +SV = PV(0xa34fdc) at 0x9f77ac REFCNT = 1 FLAGS = (POK,pPOK) - PV = 0xa53e84 "\0\0\200\377"\0 + PV = 0xa2b2f4 "\0\0\300\177"\0 CUR = 4 LEN = 12 dumping $b -SV = NV(0x90ab74) at 0xa01874 +SV = NV(0x90ab7c) at 0xa0231c REFCNT = 1 FLAGS = (NOK,pNOK) - NV = -Inf -not ok 396 - pack f NaN not-equals NaN -# Failed test 396 - pack f NaN not-equals NaN at t/op/infnan.t line 323 -# got "-Inf" -# expected != "-Inf" -# -Inf - -Inf = NaN + NV = NaN +ok 396 - pack f NaN not-equals NaN ok 397 - pack d NaN defined dumping $a -SV = PV(0xa33f3c) at 0x9f77c4 +SV = PV(0xa34fdc) at 0x9f77ac REFCNT = 1 FLAGS = (POK,IsCOW,pPOK) - PV = 0xa53e84 "\0\0\0\0\0\0\370\177"\0 + PV = 0xa2b2f4 "\0\0\0\0\0\0\370\177"\0 CUR = 8 LEN = 12 COW_REFCNT = 0 dumping $b -SV = NV(0x90ab74) at 0xa01874 +SV = NV(0x90ab7c) at 0xa0231c REFCNT = 1 FLAGS = (NOK,pNOK) NV = NaN ok 398 - pack d NaN not-equals NaN ok 399 - pack F NaN defined dumping $a -SV = PV(0xa33f3c) at 0x9f77c4 +SV = PV(0xa34fdc) at 0x9f77ac REFCNT = 1 FLAGS = (POK,IsCOW,pPOK) - PV = 0xa53e84 "\0\0\0\0\0\0\370\177"\0 + PV = 0xa2b2f4 "\0\0\0\0\0\0\370\177"\0 CUR = 8 LEN = 12 COW_REFCNT = 0 dumping $b -SV = NV(0x90ab74) at 0xa01874 +SV = NV(0x90ab7c) at 0xa0231c REFCNT = 1 FLAGS = (NOK,pNOK) NV = NaN --------------------------------------------------------------- -- bulk88 ~ bulk88 at hotmail.com
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 141b
I reckon I'm willing to ship this with a skip, or even as a known problem, if needed, but: anybody have any ideas on a simple fix? -- rjbs
Date: Tue, 19 May 2015 10:38:19 +0100
To: Ricardo SIGNES via RT <perlbug-followup [...] perl.org>
Subject: Re: [perl #125203] "pack f NaN not-equals NaN" fails in t/op/infnan.t on VC6
From: Dave Mitchell <davem [...] iabyn.com>
CC: perl5-porters [...] perl.org
On Mon, May 18, 2015 at 07:13:18PM -0700, Ricardo SIGNES via RT wrote: Show quoted text
> I reckon I'm willing to ship this with a skip, or even as a known > problem, if needed, but: anybody have any ideas on a simple fix?
Well, it's an issue with "pack 'f', NaN" under VC6. Either its not correctly converting the string "NaN" into a NaN f/p value, or its failing to pack the NaN value correctly. The difference in the result of pack 'f', NaN between VC6 and VC7 is - PV = 0xa53e84 "\0\0\200\377"\0 + PV = 0xa2b2f4 "\0\0\300\177"\0 and on my linux/gcc system it's "\0\0\300\177"\0 The VC6 one is the IEEE 754 representation of -Inf, the VC7 (correct) one in IEEE754 is a NaN. Someone with a VC6 system would have to debug it further (probably by single-stepping through the "case 'f'" branch in S_pack_rec. If no-one can do that, then I'd suggest listing it as a known problem. -- More than any other time in history, mankind faces a crossroads. One path leads to despair and utter hopelessness. The other, to total extinction. Let us pray we have the wisdom to choose correctly. -- Woody Allen
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 360b
On Tue May 19 02:38:43 2015, davem wrote: Show quoted text
> Someone with a VC6 system would have to debug it further (probably by > single-stepping through the "case 'f'" branch in S_pack_rec.
Patch attached. I was originally hoping jhi who seems to now be inactive now wouldve figured it out and written a patch faster than I would have. -- bulk88 ~ bulk88 at hotmail.com
Subject: 0001-fix-125203-pack-f-NAN-must-account-for-NAN_COMPARE_B.patch
From eeb8eb6d1105e9ff711aac2dd3149c3e51ca243e Mon Sep 17 00:00:00 2001 From: Daniel Dragan <bulk88@hotmail.com> Date: Tue, 19 May 2015 13:22:40 -0400 Subject: [PATCH] fix #125203, pack('f', $NAN) must account for NAN_COMPARE_BROKEN platforms VC6 was returning either packed float +inf or packed float -inf (I dont remember) instead of packed float NAN in t/op/infnan.t . --- pp_pack.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/pp_pack.c b/pp_pack.c index 1d732a8..cf1074e 100644 --- a/pp_pack.c +++ b/pp_pack.c @@ -2672,6 +2672,11 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) afloat = -FLT_MAX; else afloat = (float)anv; # else +#if defined(NAN_COMPARE_BROKEN) && defined(Perl_isnan) + if(Perl_isnan(anv)) + afloat = (float)NV_NAN; + else +#endif /* a simple cast to float is undefined if outside * the range of values that can be represented */ afloat = (float)(anv > FLT_MAX ? NV_INF : -- 1.7.9.msysgit.0
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 290b
On Tue May 19 10:29:51 2015, bulk88 wrote: Show quoted text
> On Tue May 19 02:38:43 2015, davem wrote:
> > Someone with a VC6 system would have to debug it further (probably by > > single-stepping through the "case 'f'" branch in S_pack_rec.
> > Patch attached.
Bump. -- bulk88 ~ bulk88 at hotmail.com
From: Steve Hay <steve.m.hay [...] googlemail.com>
Date: Thu, 21 May 2015 01:04:31 +0100
CC: "perl5-porters [...] perl.org" <perl5-porters [...] perl.org>
To: bulk88 via RT <perlbug-followup [...] perl.org>
Subject: Re: [perl #125203] "pack f NaN not-equals NaN" fails in t/op/infnan.t on VC6
Download (untitled) / with headers
text/plain 850b
On 20 May 2015 at 19:06, bulk88 via RT <perlbug-followup@perl.org> wrote: Show quoted text
> On Tue May 19 10:29:51 2015, bulk88 wrote:
>> On Tue May 19 02:38:43 2015, davem wrote:
>> > Someone with a VC6 system would have to debug it further (probably by >> > single-stepping through the "case 'f'" branch in S_pack_rec.
>> >> Patch attached.
> > Bump. >
The patch fixes the failing test for me, but it's not my call whether to commit it before 5.23 (or whether we're going to have an RC2). I also noticed in testing that porting\cmp_version.t is hanging in this VC6 build. I haven't investigated further and I'm out of time right now. I'll try to see tomorrow if it's just VC6 and/or just this machine. I haven't noticed that problem in other testing, but most of my other testing has been of the RC1 tarball, and that test is skipped outside of a git checkout.
Date: Wed, 20 May 2015 20:56:49 -0400
To: Steve Hay <steve.m.hay [...] googlemail.com>
Subject: Re: [perl #125203] "pack f NaN not-equals NaN" fails in t/op/infnan.t on VC6
From: Ricardo Signes <perl.p5p [...] rjbs.manxome.org>
CC: bulk88 via RT <perlbug-followup [...] perl.org>, "perl5-porters [...] perl.org" <perl5-porters [...] perl.org>
Download (untitled) / with headers
text/plain 298b
* Steve Hay <steve.m.hay@googlemail.com> [2015-05-20T20:04:31] Show quoted text
> The patch fixes the failing test for me, but it's not my call whether > to commit it before 5.23 (or whether we're going to have an RC2).
After look through the code, I have committed it. I will make an RC2 tomorrow-ish. -- rjbs
Download signature.asc
application/pgp-signature 473b

Message body not shown because it is not plain text.

RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 585b
On Wed May 20 17:57:23 2015, perl.p5p@rjbs.manxome.org wrote: Show quoted text
> * Steve Hay <steve.m.hay@googlemail.com> [2015-05-20T20:04:31]
> > The patch fixes the failing test for me, but it's not my call whether > > to commit it before 5.23 (or whether we're going to have an RC2).
> > After look through the code, I have committed it. I will make an RC2 > tomorrow-ish. >
Commited as http://perl5.git.perl.org/perl.git/commit/d22fb6ca0a489331fea369e4ab9a5d4013de1bb0 and released in 5.22. It is close time for this ticket, but I dont have perms to do it. -- bulk88 ~ bulk88 at hotmail.com
RT-Send-CC: perl5-porters [...] perl.org
thanks, resolved. -- rjbs


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