Backport #7454

PPTestModule test failuere on Windows 8

Added by Heesob Park over 1 year ago. Updated over 1 year ago.

[ruby-core:50255]
Status:Closed
Priority:Normal
Assignee:Usaku NAKAMURA

Description

I found following test failures with VC 2012 64bit compiler on Windows 8.

[ 436/9569] PPTestModule::PPCycleTest#testanonymous = 0.00 s
1) Failure:
test
anonymous(PPTestModule::PPCycleTest) [C:/work/snapshot/test/test_pp.rb:151]:
<"#<#Class:0x00001682e1a2b0:0x00001682e1a260>\n"> expected but was
<"#<#Class:0x00001682e1a2b0:0x00000082e1a260>\n">.

[ 439/9569] PPTestModule::PPCycleTest#testobject = 0.00 s
2) Failure:
test
object(PPTestModule::PPCycleTest) [C:/work/snapshot/test/test_pp.rb:146]:
<"#>\n"> expected but was
<"#>\n">.

[ 449/9569] PPTestModule::PPInspectTest#testtoswithiv = 0.00 s
3) Failure:
testtoswithiv(PPTestModule::PPInspectTest) [C:/work/snapshot/test/test_pp.rb:109]:
<"#\n"> expected but was
<"#\n">.

[ 450/9569] PPTestModule::PPInspectTest#testtoswithoutiv = 0.00 s
4) Failure:
testtoswithoutiv(PPTestModule::PPInspectTest) [C:/work/snapshot/test/test_pp.rb:116]:
<"#Object:0x00001682db8f60\n"> expected but was
<"#Object:0x00000082db8f60\n">.

The above error is related with the address range of Object allocation on Windows 8.
The address is exceeded fixnum(32bit) range.
But objectid is fixnum and pp module is based on objectid.
Thus, pp module cannot restore the original address of the Object.

C:\WINDOWS\system32>irb
irb(main):001:0> a = Object.new
=> #Object:0x00001457366bc0
irb(main):002:0> a.object_id
=> 731592160
irb(main):003:0> require 'pp'
=> true
irb(main):004:0> PP.pp(a,'')
=> "#Object:0x00000057366bc0\n"

Associated revisions

Revision 38541
Added by Usaku NAKAMURA over 1 year ago

merge revision(s) 38493,38539: [Backport #7454]

* gc.c (nonspecial_obj_id): VALUE is not compatible with Fixnum on
  LLP64 platform, such as 64bit Windows.
  reporeted by Heesob Park at  [Bug #7454], and the
  fix is suggested by akr.

* object.c (rb_obj_hash): shouldn't assume object_id can be long.
  based on a patch by Heesob Park at .
  cf. [Backport #7454]

History

#1 Updated by Usaku NAKAMURA over 1 year ago

  • Category set to test
  • Status changed from Open to Assigned
  • Assignee set to Akira Tanaka
  • Target version set to 2.0.0

#2 Updated by Akira Tanaka over 1 year ago

2012/11/28 phasis68 (Heesob Park) phasis@gmail.com:

I found following test failures with VC 2012 64bit compiler on Windows 8.

[ 436/9569] PPTestModule::PPCycleTest#testanonymous = 0.00 s
1) Failure:
test
anonymous(PPTestModule::PPCycleTest) [C:/work/snapshot/test/test_pp.rb:151]:
<"#<#Class:0x00001682e1a2b0:0x00001682e1a260>\n"> expected but was
<"#<#Class:0x00001682e1a2b0:0x00000082e1a260>\n">.

Although the test failures are fixable in pp.rb,
I think it means more generic problem.

If two objects have addresses where lower 32bits is same but
higher 32bits are different,
object_ids of them will be same in Windows 8 64bit Ruby.

How do you think, usa?
--
Tanaka Akira

#3 Updated by Usaku NAKAMURA over 1 year ago

  • Assignee changed from Akira Tanaka to Usaku NAKAMURA

Ah, I see, it may be a bug of Object#object_id.
I saw like problem recently...

#4 Updated by Usaku NAKAMURA over 1 year ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r38493.
Heesob, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • gc.c (nonspecialobjid): VALUE is not compatible with Fixnum on LLP64 platform, such as 64bit Windows. reporeted by Heesob Park at [Bug #7454], and the fix is suggested by akr.

#5 Updated by Usaku NAKAMURA over 1 year ago

  • Tracker changed from Bug to Backport
  • Project changed from ruby-trunk to Backport93
  • Category deleted (test)
  • Status changed from Closed to Assigned
  • Target version deleted (2.0.0)

Maybe I've fixed.
Park-san, could you check it?
If it's OK, I'll backport it to 1.9.3.

#6 Updated by Heesob Park over 1 year ago

This issue is not solved with changeset r38493.

r38493 caused build failure.

C:\work\snapshot-ms64>nmake

Microsoft(R) Program Maintenance Utility 버전 11.00.50727.1
Copyright (c) Microsoft Corporation. All rights reserved.

    CC = cl -nologo
    LD = cl -nologo
    LDSHARED = cl -nologo -LD
    CFLAGS = -MD -Zi -W2 -wd4996 -we4028 -we4142 -O2sy-  -Zm600
    XCFLAGS = -DRUBY_EXPORT -I. -I.ext/include/x64-mswin64_110 -I./include -

I. -I./missing
CPPFLAGS =
DLDFLAGS = -incremental:no -debug -opt:ref -opt:icf -dll
SOLIBS =
Creating config.h
.ext\include\x64-mswin64110\ruby\config.h updated.
Creating verconf.h
verconf.h updated.
Creating config.status
compiling main.c
main.c
compiling dmydln.c
dmydln.c
compiling miniruby.rc
compiling dmyencoding.c
dmyencoding.c
compiling version.c
version.c
compiling dmyversion.c
dmyversion.c
compiling miniprelude.c
miniprelude.c
copying dummy probes.h
compiling array.c
array.c
compiling bignum.c
bignum.c
compiling class.c
class.c
compiling compar.c
compar.c
compiling complex.c
complex.c
compiling dir.c
dir.c
compiling dln
find.c
dlnfind.c
compiling enum.c
enum.c
compiling enumerator.c
enumerator.c
compiling error.c
error.c
compiling eval.c
eval.c
compiling load.c
load.c
compiling proc.c
proc.c
compiling file.c
file.c
compiling gc.c
gc.c
compiling hash.c
hash.c
compiling inits.c
inits.c
compiling io.c
io.c
compiling marshal.c
marshal.c
compiling math.c
math.c
compiling node.c
node.c
compiling numeric.c
numeric.c
compiling object.c
object.c
compiling pack.c
pack.c
compiling parse.c
parse.c
compiling process.c
process.c
compiling random.c
random.c
compiling range.c
range.c
compiling rational.c
rational.c
compiling re.c
re.c
compiling regcomp.c
regcomp.c
compiling regenc.c
regenc.c
compiling regerror.c
regerror.c
compiling regexec.c
regexec.c
compiling regparse.c
regparse.c
compiling regsyntax.c
regsyntax.c
compiling ruby.c
ruby.c
compiling safe.c
safe.c
compiling signal.c
signal.c
compiling sprintf.c
sprintf.c
compiling st.c
st.c
compiling strftime.c
strftime.c
compiling string.c
string.c
compiling struct.c
struct.c
compiling time.c
time.c
compiling transcode.c
transcode.c
compiling util.c
util.c
compiling variable.c
variable.c
compiling compile.c
compile.c
compiling debug.c
debug.c
compiling iseq.c
iseq.c
compiling vm.c
vm.c
compiling vm
dump.c
vmdump.c
compiling vm
backtrace.c
vmbacktrace.c
compiling vm
trace.c
vmtrace.c
compiling thread.c
thread.c
compiling cont.c
cont.c
compiling ./enc/ascii.c
ascii.c
compiling ./enc/us
ascii.c
usascii.c
compiling ./enc/unicode.c
unicode.c
compiling ./enc/utf
8.c
utf8.c
compiling newline.c
newline.c
compiling ./missing/acosh.c
acosh.c
compiling ./missing/cbrt.c
cbrt.c
compiling ./missing/crypt.c
crypt.c
compiling ./missing/erf.c
erf.c
compiling ./missing/ffs.c
ffs.c
compiling ./missing/langinfo.c
langinfo.c
compiling ./missing/lgamma
r.c
lgammar.c
compiling ./missing/strlcat.c
strlcat.c
compiling ./missing/strlcpy.c
strlcpy.c
compiling ./missing/tgamma.c
tgamma.c
compiling win32/win32.c
win32.c
compiling win32/file.c
file.c
compiling ./missing/setproctitle.c
setproctitle.c
compiling dmyext.c
dmyext.c
oldnames.lib user32.lib advapi32.lib shell32.lib ws2
32.lib imagehlp.lib shlwapi.lib
linking miniruby.exe
ruby 2.0.0dev (2012-12-21 trunk 38512) [x64-mswin64110]
rbconfig.rb updated
generating enc.mk
compiling dln.c
dln.c
compiling encoding.c
encoding.c
generating prelude.c
compiling prelude.c
prelude.c
linking static-library x64-msvcr110-ruby200-static.lib
generating x64-msvcr110-ruby200.def
linking import-library x64-msvcr110-ruby200.lib
x64-msvcr110-ruby200.lib 라이브러리 및 x64-msvcr110-ruby200.exp 개체를 생성하고 있습니다.
generating encdb.h
C:/work/snapshot-ms64/lib/optparse.rb:584:in hash': bignum too big to convert intolong' (RangeError)
from C:/work/snapshot-ms64/lib/optparse.rb:584:in []='
from C:/work/snapshot-ms64/lib/optparse.rb:584:in
accept'
from C:/work/snapshot-ms64/lib/optparse.rb:921:in accept'
from C:/work/snapshot-ms64/lib/optparse.rb:1619:in
class:OptionParser'
from C:/work/snapshot-ms64/lib/optparse.rb:212:in <top (required)>'
from ./tool/generic_erb.rb:3:in
require'
from ./tool/generic
erb.rb:3:in `'
NMAKE : fatal error U1077: '.\miniruby.exe' : '0x1' 반환 코드입니다.
Stop.

And here is patch for this error.

diff --git a/object.c b/object.c.new
index f0cd1f8..611e959 100644
--- a/object.c
+++ b/object.c.new
@@ -125,7 +125,7 @@ VALUE
rbobjhash(VALUE obj)
{
VALUE oid = rbobjid(obj);
- stindext h = rbhashend(rbhashstart(NUM2LONG(oid)));
+ stindext h = rbhashend(rbhashstart(NUM2LL(oid)));
return LONG2FIX(h);
}

#7 Updated by Usaku NAKAMURA over 1 year ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r38541.
Heesob, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 38493,38539: [Backport #7454]

* gc.c (nonspecial_obj_id): VALUE is not compatible with Fixnum on
  LLP64 platform, such as 64bit Windows.
  reporeted by Heesob Park at  [Bug #7454], and the
  fix is suggested by akr.

* object.c (rb_obj_hash): shouldn't assume object_id can be long.
  based on a patch by Heesob Park at .
  cf. [Backport #7454]

#8 Updated by Usaku NAKAMURA over 1 year ago

Hello,

Thank you very much for helping always!

In message " [Backport93 - Backport #7454] PPTestModule test failuere on Windows 8"
on Dec.22,2012 00:12:32, phasis@gmail.com wrote:

Issue #7454 has been updated by phasis68 (Heesob Park).

This issue is not solved with changeset r38493.

r38493 caused build failure.

C:\work\snapshot-ms64>nmake

Microsoft(R) Program Maintenance Utility ?? 11.00.50727.1
Copyright (c) Microsoft Corporation. All rights reserved.

    CC = cl -nologo
    LD = cl -nologo
    LDSHARED = cl -nologo -LD
    CFLAGS = -MD -Zi -W2 -wd4996 -we4028 -we4142 -O2sy-  -Zm600
    XCFLAGS = -DRUBY_EXPORT -I. -I.ext/include/x64-mswin64_110 -I./include -

I. -I./missing
CPPFLAGS =
DLDFLAGS = -incremental:no -debug -opt:ref -opt:icf -dll
SOLIBS =
Creating config.h
.ext\include\x64-mswin64110\ruby\config.h updated.
Creating verconf.h
verconf.h updated.
Creating config.status
compiling main.c
main.c
compiling dmydln.c
dmydln.c
compiling miniruby.rc
compiling dmyencoding.c
dmyencoding.c
compiling version.c
version.c
compiling dmyversion.c
dmyversion.c
compiling miniprelude.c
miniprelude.c
copying dummy probes.h
compiling array.c
array.c
compiling bignum.c
bignum.c
compiling class.c
class.c
compiling compar.c
compar.c
compiling complex.c
complex.c
compiling dir.c
dir.c
compiling dln
find.c
dlnfind.c
compiling enum.c
enum.c
compiling enumerator.c
enumerator.c
compiling error.c
error.c
compiling eval.c
eval.c
compiling load.c
load.c
compiling proc.c
proc.c
compiling file.c
file.c
compiling gc.c
gc.c
compiling hash.c
hash.c
compiling inits.c
inits.c
compiling io.c
io.c
compiling marshal.c
marshal.c
compiling math.c
math.c
compiling node.c
node.c
compiling numeric.c
numeric.c
compiling object.c
object.c
compiling pack.c
pack.c
compiling parse.c
parse.c
compiling process.c
process.c
compiling random.c
random.c
compiling range.c
range.c
compiling rational.c
rational.c
compiling re.c
re.c
compiling regcomp.c
regcomp.c
compiling regenc.c
regenc.c
compiling regerror.c
regerror.c
compiling regexec.c
regexec.c
compiling regparse.c
regparse.c
compiling regsyntax.c
regsyntax.c
compiling ruby.c
ruby.c
compiling safe.c
safe.c
compiling signal.c
signal.c
compiling sprintf.c
sprintf.c
compiling st.c
st.c
compiling strftime.c
strftime.c
compiling string.c
string.c
compiling struct.c
struct.c
compiling time.c
time.c
compiling transcode.c
transcode.c
compiling util.c
util.c
compiling variable.c
variable.c
compiling compile.c
compile.c
compiling debug.c
debug.c
compiling iseq.c
iseq.c
compiling vm.c
vm.c
compiling vm
dump.c
vmdump.c
compiling vm
backtrace.c
vmbacktrace.c
compiling vm
trace.c
vmtrace.c
compiling thread.c
thread.c
compiling cont.c
cont.c
compiling ./enc/ascii.c
ascii.c
compiling ./enc/us
ascii.c
usascii.c
compiling ./enc/unicode.c
unicode.c
compiling ./enc/utf
8.c
utf8.c
compiling newline.c
newline.c
compiling ./missing/acosh.c
acosh.c
compiling ./missing/cbrt.c
cbrt.c
compiling ./missing/crypt.c
crypt.c
compiling ./missing/erf.c
erf.c
compiling ./missing/ffs.c
ffs.c
compiling ./missing/langinfo.c
langinfo.c
compiling ./missing/lgamma
r.c
lgammar.c
compiling ./missing/strlcat.c
strlcat.c
compiling ./missing/strlcpy.c
strlcpy.c
compiling ./missing/tgamma.c
tgamma.c
compiling win32/win32.c
win32.c
compiling win32/file.c
file.c
compiling ./missing/setproctitle.c
setproctitle.c
compiling dmyext.c
dmyext.c
oldnames.lib user32.lib advapi32.lib shell32.lib ws2
32.lib imagehlp.lib shlwapi.lib
linking miniruby.exe
ruby 2.0.0dev (2012-12-21 trunk 38512) [x64-mswin64110]
rbconfig.rb updated
generating enc.mk
compiling dln.c
dln.c
compiling encoding.c
encoding.c
generating prelude.c
compiling prelude.c
prelude.c
linking static-library x64-msvcr110-ruby200-static.lib
generating x64-msvcr110-ruby200.def
linking import-library x64-msvcr110-ruby200.lib
x64-msvcr110-ruby200.lib ????? ? x64-msvcr110-ruby200.exp ??? ???? ????.
generating encdb.h
C:/work/snapshot-ms64/lib/optparse.rb:584:in hash': bignum too big to convert intolong' (RangeError)
from C:/work/snapshot-ms64/lib/optparse.rb:584:in []='
from C:/work/snapshot-ms64/lib/optparse.rb:584:in
accept'
from C:/work/snapshot-ms64/lib/optparse.rb:921:in accept'
from C:/work/snapshot-ms64/lib/optparse.rb:1619:in
class:OptionParser'
from C:/work/snapshot-ms64/lib/optparse.rb:212:in <top (required)>'
from ./tool/generic_erb.rb:3:in
require'
from ./tool/generic
erb.rb:3:in `'
NMAKE : fatal error U1077: '.\miniruby.exe' : '0x1' ?? ?????.
Stop.

And here is patch for this error.

diff --git a/object.c b/object.c.new
index f0cd1f8..611e959 100644
--- a/object.c
+++ b/object.c.new
@@ -125,7 +125,7 @@ VALUE
rbobjhash(VALUE obj)
{
VALUE oid = rbobjid(obj);
- stindext h = rbhashend(rbhashstart(NUM2LONG(oid)));
+ stindext h = rbhashend(rbhashstart(NUM2LL(oid)));
return LONG2FIX(h);
}


Backport #7454: PPTestModule test failuere on Windows 8
https://bugs.ruby-lang.org/issues/7454#change-34986

Author: phasis68 (Heesob Park)
Status: Assigned
Priority: Normal
Assignee: usa (Usaku NAKAMURA)
Category:
Target version:

I found following test failures with VC 2012 64bit compiler on Windows 8.

[ 436/9569] PPTestModule::PPCycleTest#testanonymous = 0.00 s
1) Failure:
test
anonymous(PPTestModule::PPCycleTest) [C:/work/snapshot/test/test_pp.rb:151]:
<"#<#Class:0x00001682e1a2b0:0x00001682e1a260>\n"> expected but was
<"#<#Class:0x00001682e1a2b0:0x00000082e1a260>\n">.

[ 439/9569] PPTestModule::PPCycleTest#testobject = 0.00 s
2) Failure:
test
object(PPTestModule::PPCycleTest) [C:/work/snapshot/test/test_pp.rb:146]:
<"#>\n"> expected but was
<"#>\n">.

[ 449/9569] PPTestModule::PPInspectTest#testtoswithiv = 0.00 s
3) Failure:
testtoswithiv(PPTestModule::PPInspectTest) [C:/work/snapshot/test/test_pp.rb:109]:
<"#\n"> expected but was
<"#\n">.

[ 450/9569] PPTestModule::PPInspectTest#testtoswithoutiv = 0.00 s
4) Failure:
testtoswithoutiv(PPTestModule::PPInspectTest) [C:/work/snapshot/test/test_pp.rb:116]:
<"#Object:0x00001682db8f60\n"> expected but was
<"#Object:0x00000082db8f60\n">.

The above error is related with the address range of Object allocation on Windows 8.
The address is exceeded fixnum(32bit) range.
But objectid is fixnum and pp module is based on objectid.
Thus, pp module cannot restore the original address of the Object.

C:\WINDOWS\system32>irb
irb(main):001:0> a = Object.new
=> #Object:0x00001457366bc0
irb(main):002:0> a.object_id
=> 731592160
irb(main):003:0> require 'pp'
=> true
irb(main):004:0> PP.pp(a,'')
=> "#Object:0x00000057366bc0\n"

http://bugs.ruby-lang.org/

Regards,
--
U.Nakamura usa@garbagecollect.jp

Also available in: Atom PDF