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-mswin64_110\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
dln_find.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
vm_dump.c
compiling vm_backtrace.c
vm_backtrace.c
compiling vm_trace.c
vm_trace.c
compiling thread.c
thread.c
compiling cont.c
cont.c
compiling ./enc/ascii.c
ascii.c
compiling ./enc/us_ascii.c
us_ascii.c
compiling ./enc/unicode.c
unicode.c
compiling ./enc/utf_8.c
utf_8.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
lgamma_r.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-mswin64_110]
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 into `long' (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 `<main>'
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
 rb_obj_hash(VALUE obj)
 {
     VALUE oid = rb_obj_id(obj);
-    st_index_t h = rb_hash_end(rb_hash_start(NUM2LONG(oid)));
+    st_index_t h = rb_hash_end(rb_hash_start(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#test_anonymous = 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#test_object = 0.00 s
  2) Failure:
test_object(PPTestModule::PPCycleTest) [C:/work/snapshot/test/test_pp.rb:146]:
<"#<Object:0x00001682e0b8f0 @a=#<Object:0x00001682e0b8f0 ...>>\n"> expected but was
<"#<Object:0x00000082e0b8f0 @a=#<Object:0x00000082e0b8f0 ...>>\n">.

[ 449/9569] PPTestModule::PPInspectTest#test_to_s_with_iv = 0.00 s
  3) Failure:
test_to_s_with_iv(PPTestModule::PPInspectTest) [C:/work/snapshot/test/test_pp.rb:109]:
<"#<Object:0x00001682db99b0 @a=nil>\n"> expected but was
<"#<Object:0x00000082db99b0 @a=nil>\n">.

[ 450/9569] PPTestModule::PPInspectTest#test_to_s_without_iv = 0.00 s
  4) Failure:
test_to_s_without_iv(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 object_id is fixnum and pp module is based on object_id.
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/