Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"pack f NaN not-equals NaN" fails in t/op/infnan.t on VC6 #14705

Closed
p5pRT opened this issue May 16, 2015 · 13 comments

Comments

@p5pRT
Copy link
Collaborator

@p5pRT p5pRT commented May 16, 2015

Migrated from rt.perl.org#125203 (status was 'resolved')

Searchable as RT125203$

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 16, 2015

From @bulk88

Created by @bulk88

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
------------------------------------------------------------------------------------

Perl Info

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)

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 16, 2015

From @bulk88

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

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 19, 2015

From @rjbs

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

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 19, 2015

The RT System itself - Status changed from 'new' to 'open'

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 19, 2015

From @iabyn

On Mon, May 18, 2015 at 07​:13​:18PM -0700, Ricardo SIGNES via RT wrote​:

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

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 19, 2015

From @bulk88

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. 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

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 19, 2015

From @bulk88

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

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 20, 2015

From @bulk88

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.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 21, 2015

From @steve-m-hay

On 20 May 2015 at 19​:06, bulk88 via RT <perlbug-followup@​perl.org> wrote​:

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.

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 21, 2015

From @rjbs

* 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.

--
rjbs

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 27, 2015

From @bulk88

On Wed May 20 17​:57​:23 2015, perl.p5p@​rjbs.manxome.org wrote​:

* 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

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 27, 2015

From @rjbs

thanks, resolved.

--
rjbs

@p5pRT p5pRT closed this Jun 27, 2015
@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 27, 2015

@rjbs - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.