Project

General

Profile

Actions

Bug #3490

closed

test_pack_utf8 failure on mswin64

Added by beuniv (shintaro kuwamoto) almost 14 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.3dev (2010-06-27 trunk 28450) [x64-mswin64_90]
Backport:

Description

=begin
test_integer_combのtest_pack_utf8がmswin64環境で失敗します。
aが-0x80000001の時に期待されているRangeErrorが投げられずに素通りします。

NUM2LONGの戻り値の型がlongなので、pack.:908行目で小さい型への変換が起こるようです。
NUM2LONGを使わずに、直接NUM2LONG_internalに置き換えると成功します。

Z:\ruby_trunk\build>nmake test-all TESTS=ruby\test_integer_comb.rb

Microsoft(R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

     .\ruby.exe -I../lib -I".ext/x64-mswin64_90" "../tool/runruby.rb" --extou

t=".ext" -- "../test/runner.rb" ruby\test_integer_comb.rb
Loaded suite ../test/runner
Started
..................F....................
Finished in 6.465000 seconds.

  1. Failure:
    test_pack_utf8(TestIntegerComb) [Z:/ruby_trunk/test/ruby/test_integer_comb.rb:61
    4]:
    RangeError expected but nothing was raised.

39 tests, 1332736 assertions, 1 failures, 0 errors, 0 skips

Test run options: --seed 56768
NMAKE : fatal error U1077: '.\ruby.exe' : リターン コード '0x1'
Stop.
=end

Actions #1

Updated by mame (Yusuke Endoh) almost 14 years ago

  • Status changed from Open to Assigned
  • Assignee set to usa (Usaku NAKAMURA)
  • Priority changed from Normal to 3

=begin
遠藤です。

受理されるべきでない値が受理されるのでバグですが、受理されるべき
値が受理されないわけではないので、致命的ではないと判断し優先度を
Low にします。
個人的には 1.9.2 では WONTFIX が望ましいと思いますが、usa さんの
意見はどうでしょうか。

SIGNED_VALUE rb_big2long(VALUE x)

あたりが、sizeof(VALUE) == sizeof(long) を期待している気がする
ので、以下のようなパッチで直るんじゃないかと思いました。
ただ、直ったとしてもこのパッチには他の環境での影響が怖いのと、
他にも直すべき場所がありそう (rb_big2ulong とか) なので、検討が
必要だと思います。

diff --git a/bignum.c b/bignum.c
index 24f1340..cd2fbcb 100644
--- a/bignum.c
+++ b/bignum.c
@@ -1189,11 +1189,11 @@ rb_big2long(VALUE x)
{
VALUE num = big2ulong(x, "long", TRUE);

  • if ((SIGNED_VALUE)num < 0 &&
  • (RBIGNUM_SIGN(x) || (SIGNED_VALUE)num != LONG_MIN)) {
  • if ((long)num < 0 &&
  • (RBIGNUM_SIGN(x) || (long)num != LONG_MIN)) {
    rb_raise(rb_eRangeError, "bignum too big to convert into `long'");
    }
  • if (!RBIGNUM_SIGN(x)) return -(SIGNED_VALUE)num;
  • if (!RBIGNUM_SIGN(x)) return (VALUE)(-(long)num);
    return num;
    }

--
Yusuke Endoh
=end

Actions #2

Updated by naruse (Yui NARUSE) over 13 years ago

  • Priority changed from 3 to Normal
  • Target version changed from 1.9.2 to 1.9.3

=begin
忘れ去られている気がするので、一度優先度を上げます
=end

Actions #3

Updated by usa (Usaku NAKAMURA) over 13 years ago

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

=begin
This issue was solved with changeset r29612.
shintaro, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions #4

Updated by usa (Usaku NAKAMURA) over 13 years ago

  • Status changed from Closed to Assigned

=begin
というわけで今頃対応してみたのですが、これで十分じゃないかと思いつつも、
いまいち確信は持てません。難しい。
これでいいなら他の環境への影響なしで済むんですが。

なお、test/rubyはこれで全部通ってるような気はします。

=end

Actions #5

Updated by usa (Usaku NAKAMURA) over 13 years ago

  • Status changed from Assigned to Closed

=begin

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0