Issue #5152 has been reported by Tomoyuki Chikanaga.

----------------------------------------
Bug #5152: TestDateNew#test_civil ??? GC.stress = true ???? Failure
http://redmine.ruby-lang.org/issues/5152

Author: Tomoyuki Chikanaga
Status: Open
Priority: Normal
Assignee: tadayoshi funaba
Category: ext
Target version: 1.9.3
ruby -v: ruby 1.9.4dev (2011-08-03 trunk 32823) [x86_64-linux]


make test-all TESTS="-vq --gc-stress date/test_date_new.rb -n test_civil"
?????????? GC.stress = true ???? DateTime ??????????? Failure ??????????

  1) Failure:
test_civil(TestDateNew) [/home/chikanaga/opt/ruby-trunk/src/ruby/test/date/test_date_new.rb:100]:
<[-4712, 1, 1, 0, 0, 0, (3/8)]> expected but was
<[-4712, 1, 1, 0, 0, 0, (0/1)]>.

以???????????????????????????????????????? ruby_1_9_3 ????????????????????

$ cat datetime.rb
require "date"
GC.stress = true
dt = DateTime.civil(-4712,1,1, 0,0,0, '+0900')
p dt.offset   # => (3/8) ???????????? (0/1) ?????

date_parse.c ??? date_zone_to_diff ???? str ??? GC ?護????????????????????????????????????
以????????????????????????? offset ??????????????????????????????????

diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c
index 3605ff7..e41606b 100644
--- a/ext/date/date_parse.c
+++ b/ext/date/date_parse.c
@@ -374,6 +374,7 @@ date_zone_to_diff(VALUE str)
            sp = 0;
        }
     }
+    RB_GC_GUARD(str);
     if (d > dest) {
        if (*(d - 1) == ' ')
            --d;



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