[Bug #3490][Assigned] test_pack_utf8 failure on mswin64

e$B%A%1%C%He(B #3490 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BAssignede$B$KJQ99e(B
e$BC4Ev<Te(B Usaku NAKAMURAe$B$K%;%C%He(B
e$BM%@hEYe(B Normale$B$+$ie(BLowe$B$KJQ99e(B

e$B1sF#$G$9!#e(B

e$B<uM}$5$l$k$Y$-$G$J$$CM$,<uM}$5$l$k$N$G%P%0$G$9$,!"<uM}$5$l$k$Y$-e(B
e$BCM$,<uM}$5$l$J$$$o$1$G$O$J$$$N$G!"CWL?E*$G$O$J$$$HH=CG$7M%@hEY$re(B
Low e$B$K$7$^$9!#e(B
e$B8D?ME*$K$Oe(B 1.9.2 e$B$G$Oe(B WONTFIX
e$B$,K>$^$7$$$H;W$$$^$9$,!"e(Busa e$B$5$s$Ne(B
e$B0U8+$O$I$&$G$7$g$&$+!#e(B

SIGNED_VALUE rb_big2long(VALUE x)

e$B$"$?$j$,!"e(Bsizeof(VALUE) == sizeof(long)
e$B$r4|BT$7$F$$$k5$$,$9$ke(B
e$B$N$G!"0J2<$N$h$&$J%Q%C%A$GD>$k$s$8$c$J$$$+$H;W$$$^$7$?!#e(B
e$B$?$@!"D>$C$?$H$7$F$b$3$N%Q%C%A$K$OB>$N4D6-$G$N1F6A$,I]$$$N$H!“e(B
e$BB>$K$bD>$9$Y$->l=j$,$”$j$=$&e(B (rb_big2ulong e$B$H$+e(B)
e$B$J$N$G!"8!F$$,e(B
e$BI,MW$@$H;W$$$^$9!#e(B

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 E. [email protected]

http://redmine.ruby-lang.org/issues/show/3490

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:41752] [Bug #3490][Assigned] test_pack_utf8
failure on mswin64”
on Jun.28,2010 05:15:28, [email protected] wrote:

e$B<uM}$5$l$k$Y$-$G$J$$CM$,<uM}$5$l$k$N$G%P%0$G$9$,!"<uM}$5$l$k$Y$-e(B
e$BCM$,<uM}$5$l$J$$$o$1$G$O$J$$$N$G!"CWL?E*$G$O$J$$$HH=CG$7M%@hEY$re(B
Low e$B$K$7$^$9!#e(B
e$B8D?ME*$K$Oe(B 1.9.2 e$B$G$Oe(B WONTFIX e$B$,K>$^$7$$$H;W$$$^$9$,!"e(Busa e$B$5$s$Ne(B
e$B0U8+$O$I$&$G$7$g$&$+!#e(B

e$B:#$N%?%$%_%s%0$@$HI]$9$.$k$N$G!";d$be(B1.9.2e$B$O$$$8$i$J$$J}$,$$$$e(B
e$B$h$&$J5$$,$7$^$9!#e(B

SIGNED_VALUE rb_big2long(VALUE x)

e$B$"$?$j$,!"e(Bsizeof(VALUE) == sizeof(long) e$B$r4|BT$7$F$$$k5$$,$9$ke(B
e$B$N$G!"0J2<$N$h$&$J%Q%C%A$GD>$k$s$8$c$J$$$+$H;W$$$^$7$?!#e(B

e$B$(!<$H!“e(Bnum != LONG_MINe$B$,$”$k$&$A$O%@%a$8$c$J$$$G$9$+$M!#e(B
e$B$H$$$&$o$1$GKvHx$N%Q%C%A$N$h$&$J46$8$8$c$J$$$H$$$1$J$$$s$8$ce(B
e$B$J$$$+$H;W$$$^$9e(B(e$BL$3NG’e(B)e$B!#e(B

e$B$?$@!"D>$C$?$H$7$F$b$3$N%Q%C%A$K$OB>$N4D6-$G$N1F6A$,I]$$$N$H!“e(B
e$BB>$K$bD>$9$Y$->l=j$,$”$j$=$&e(B (rb_big2ulong e$B$H$+e(B) e$B$J$N$G!"8!F$$,e(B
e$BI,MW$@$H;W$$$^$9!#e(B

e$BF10U$7$^$9!#e(B
r10511e$B$GJQ99$5$l$?$H$3$m$OMW%A%'%C%/$+$J$"!#e(B

Index: bignum.c

— bignum.c (revision 28430)
+++ bignum.c (working copy)
@@ -1189,8 +1189,9 @@ rb_big2long(VALUE x)
{
VALUE num = big2ulong(x, “long”, TRUE);

  • if ((SIGNED_VALUE)num < 0 &&
  • (RBIGNUM_SIGN(x) || (SIGNED_VALUE)num != LONG_MIN)) {
  • if (((SIGNED_VALUE)num > 0 && num > (SIGNED_VALUE)LONG_MAX) ||
  • ((SIGNED_VALUE)num < 0 &&
  • (RBIGNUM_SIGN(x) || (SIGNED_VALUE)num < (SIGNED_VALUE)LONG_MIN))) {
    rb_raise(rb_eRangeError, “bignum too big to convert into `long’”);
    }
    if (!RBIGNUM_SIGN(x)) return -(SIGNED_VALUE)num;

e$B$=$l$G$O!#e(B

e$B$3$s$K$A$Oe(B

  • if (((SIGNED_VALUE)num > 0 && num > (SIGNED_VALUE)LONG_MAX) ||

e$B$J$+$`$i$5$s$N%Q%C%A$G%F%9%HDL$j$^$7$?!#e(B

e$B$3$s$P$s$oe(B

e$B$&$5$5$s$N%Q%C%A$@$H!"e(Bsizeof(VALUE) == sizeof(long) e$B$N4D6-$Ge(B
e$B0J2<$,DL$k$h$&$K$J$C$F$7$^$$$^$9!#e(B

$ ./miniruby -e ‘p [-0xffffffff].pack(“U”)’
“\u0001”

e$B$*$C$H!#<:Ni$7$^$7$?!#e(B
e$B$($s$I$&$5$s$N%Q%C%A$G$b%F%9%HDL$k$3$H$r3NG’$7$^$7$?!#e(B
e$B$3$A$i$b!#e(B
build>miniruby -e ‘p [-0xffffffff].pack(“U”)’
-e:1:in pack': bignum too big to convert intolong’ (RangeError)
from -e:1:in `

kowamoto

e$B1sF#$G$9!#e(B

2010e$BG/e(B6e$B7ne(B28e$BF|e(B9:52 U.Nakamura [email protected]:

SIGNED_VALUE rb_big2long(VALUE x)

e$B$"$?$j$,!"e(Bsizeof(VALUE) == sizeof(long) e$B$r4|BT$7$F$$$k5$$,$9$ke(B
e$B$N$G!"0J2<$N$h$&$J%Q%C%A$GD>$k$s$8$c$J$$$+$H;W$$$^$7$?!#e(B

e$B$(!<$H!“e(Bnum != LONG_MINe$B$,$”$k$&$A$O%@%a$8$c$J$$$G$9$+$M!#e(B
e$B$H$$$&$o$1$GKvHx$N%Q%C%A$N$h$&$J46$8$8$c$J$$$H$$$1$J$$$s$8$ce(B
e$B$J$$$+$H;W$$$^$9e(B(e$BL$3NG’e(B)e$B!#e(B

e$B$&$5$5$s$N%Q%C%A$@$H!"e(Bsizeof(VALUE) == sizeof(long) e$B$N4D6-$Ge(B
e$B0J2<$,DL$k$h$&$K$J$C$F$7$^$$$^$9!#e(B

$ ./miniruby -e ‘p [-0xffffffff].pack(“U”)’
“\u0001”

sizeof(VALUE) == sizeof(long) e$B$@$He(B

(SIGNED_VALUE)num < (SIGNED_VALUE)LONG_MIN

e$B$O>o$K56$G$9!#ITEy9f$N8~$-$,5U!)$=$l$H$be(B != e$B$N$^$^$K$9$Y$-!)e(B

e$B$&!<$s!#$d$C$Q$j$3$&$$$&$H$3$m$O%(%s%P%0$7$d$9$$$G$9$M!#e(B
trunk e$B$@$1$GD>$9$3$H$K$7$^$7$g$&!#e(B

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:41757] Re: [Bug #3490][Assigned] test_pack_utf8
failure on mswin64”
on Jun.28,2010 21:54:31, [email protected] wrote:

sizeof(VALUE) == sizeof(long) e$B$@$He(B

(SIGNED_VALUE)num < (SIGNED_VALUE)LONG_MIN

e$B$O>o$K56$G$9!#ITEy9f$N8~$-$,5U!)$=$l$H$be(B != e$B$N$^$^$K$9$Y$-!)e(B

e$B$“$”!"$d$C$Q$j4V0c$($?e(B…

e$B$&!<$s!#$d$C$Q$j$3$&$$$&$H$3$m$O%(%s%P%0$7$d$9$$$G$9$M!#e(B
trunk e$B$@$1$GD>$9$3$H$K$7$^$7$g$&!#e(B

e$B$($(!"$A$c$s$H9M$($F%(%C%8%1!<%9$N%F%9%H$H$+$be(B(e$B2DG=$J$ie(B)e$BMQ0Ue(B
e$B$7$F?J$a$J$$$H$$$+$s$H;W$$$^$9!#e(B

e$B$=$l$G$O!#e(B

e$B@.@%$G$9!#e(B

2010e$BG/e(B6e$B7ne(B29e$BF|e(B9:02 U.Nakamura [email protected]:

e$B$“$”!"$d$C$Q$j4V0c$($?e(B…

e$B$&!<$s!#$d$C$Q$j$3$&$$$&$H$3$m$O%(%s%P%0$7$d$9$$$G$9$M!#e(B
trunk e$B$@$1$GD>$9$3$H$K$7$^$7$g$&!#e(B

e$B$($(!"$A$c$s$H9M$($F%(%C%8%1!<%9$N%F%9%H$H$+$be(B(e$B2DG=$J$ie(B)e$BMQ0Ue(B
e$B$7$F?J$a$J$$$H$$$+$s$H;W$$$^$9!#e(B

e$B$=$l$G$O!#e(B

1.9.2 e$B$G$be(B NUM2LONG_internal e$B$r;H$&$J$j$7$F!"e(B
workaround e$B$OF~$l$F$*$$$F$b$$$$$s$8$c$J$$$+$J$!$H$O;W$$$^$9!#e(B

MLe$BO"7H$N$?$a$N%F%9%H%a!<%k$J$N$G7Z$$%N%j$G$9$,e(B