Bug #6796

fix test failure of numeric/bignum built with clang -O

Added by Wataru Kimura over 1 year ago. Updated over 1 year ago.

[ruby-dev:46008]
Status:Rejected
Priority:Normal
Assignee:-
Category:-
Target version:-
ruby -v:ruby 1.8.7 (2012-06-29 patchlevel 370) [i686-darwin11.4.2]

Description

=begin

木村といいます。

clangで最適化オプションをつけてコンパイルすると、bignum関連のテストが
いくつか失敗していしまいます。
添付のパッチでこの問題が解決することを確認しました。

環境
* Mac OS X 10.7.4
* clang-3.0
* ruby-1.8.7-p370

% ./ruby -v
ruby 1.8.7 (2012-06-29 patchlevel 370) [i686-darwin11.4.2]
% make TESTS=ruby test-all
./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb ./runruby.rb --extout=.ext -- "./test/runner.rb" --basedir="./test" --runner=console ruby
Loaded suite ruby
Started
............................./test/ruby/testarray.rb:536: warning: given block not used
.........................................................................FE../test/ruby/test
bignum.rb:109: warning: Bignum out of Float range
./test/ruby/test_bignum.rb:110: warning: Bignum out of Float range
...............................................................................................................................................................................................................F.......F....F..F.....F..........F.......................................................................................................................................................................................................................................................................................
Finished in 68.103073 seconds.

1) Failure:
testbignum(TestBignum) [./test/ruby/testbignum.rb:20]:
expected but was
.

2) Error:
testcalc(TestBignum):
ZeroDivisionError: divided by 0
./test/ruby/test
bignum.rb:55:in modulo'
./test/ruby/test_bignum.rb:55:in
test_calc'

3) Failure:
testreadpartialpos(TestIO)
[./test/ruby/testio.rb:28:in test_readpartial_pos'
./test/ruby/test_io.rb:25:in
open'
./test/ruby/test
io.rb:25:in test_readpartial_pos'
./test/ruby/test_io.rb:9:in
mkcdtmpdir'
./test/ruby/testio.rb:8:in chdir'
./test/ruby/test_io.rb:8:in
mkcdtmpdir'
/Volumes/CHome/kimuraw/work/ruby/ruby
187/lib/tmpdir.rb:129:in mktmpdir'
./test/ruby/test_io.rb:7:in
mkcdtmpdir'
./test/ruby/testio.rb:23:in `testreadpartial_pos']:
expected but was
.

4) Failure:
testdivmod(TestInteger)
[./test/ruby/test
integer.rb:219:in test_divmod'
./test/ruby/test_integer.rb:212:in
each'
./test/ruby/testinteger.rb:212:in test_divmod'
./test/ruby/test_integer.rb:211:in
each'
./test/ruby/test
integer.rb:211:in `test_divmod']:
<-79228162514264337593543950338> expected but was
<-2>.

5) Failure:
testlshift(TestInteger)
[./test/ruby/test
integer.rb:308:in test_lshift'
./test/ruby/test_integer.rb:303:in
each'
./test/ruby/testinteger.rb:303:in test_lshift'
./test/ruby/test_integer.rb:302:in
each'
./test/ruby/test
integer.rb:302:in `test_lshift']:
-6277101735386680763835789423207666416102355444464034512898 << 63.
expected but was
<-57896044618658097711785492504343953926634992332820282019747238748030274371584>.

6) Failure:
testmult(TestInteger)
[./test/ruby/test
integer.rb:205:in test_mult'
./test/ruby/test_integer.rb:198:in
each'
./test/ruby/testinteger.rb:198:in test_mult'
./test/ruby/test_integer.rb:197:in
each'
./test/ruby/test
integer.rb:197:in `test_mult']:
-6277101735386680763835789423207666416102355444464034512898 * -4611686018427387906.
expected but was
.

7) Failure:
testpow(TestInteger)
[./test/ruby/test
integer.rb:243:in test_pow'
./test/ruby/test_integer.rb:234:in
each'
./test/ruby/testinteger.rb:234:in test_pow'
./test/ruby/test_integer.rb:233:in
each'
./test/ruby/test
integer.rb:233:in `test_pow']:
((-4611686018427387904) ** 2) / -4611686018427387904 / ...(2 times)...
expected but was
.

8) Failure:
testrshift(TestInteger)
[./test/ruby/test
integer.rb:330:in test_rshift'
./test/ruby/test_integer.rb:325:in
each'
./test/ruby/testinteger.rb:325:in test_rshift'
./test/ruby/test_integer.rb:324:in
each'
./test/ruby/test
integer.rb:324:in `test_rshift']:
-6277101735386680763835789423207666416102355444464034512898 >> -65.
expected but was
<-231584178474632390847141970017375815706539969331281128078988954992121097486336>.

624 tests, 452824 assertions, 7 failures, 1 errors
make: *** [test-all] Error 1
make TESTS=ruby test-all 62.34s user 0.91s system 92% cpu 1:08.44 total

=end

patch-numeric.c.diff Magnifier (876 Bytes) Wataru Kimura, 07/26/2012 10:29 PM

Associated revisions

Revision 36546
Added by Akinori MUSHA over 1 year ago

  • numeric.c (intpow, fixmul): Avoid optimization bugs of clang. Submitted by Wataru Kimura [Bug #6796].

History

#1 Updated by Shota Fukumori over 1 year ago

  • Project changed from Backport87 to Ruby 1.8

#2 Updated by Shota Fukumori over 1 year ago

  • Tracker changed from Feature to Bug

#3 Updated by Shota Fukumori over 1 year ago

  • Status changed from Open to Rejected
  • ruby -v set to ruby 1.8.7 (2012-06-29 patchlevel 370) [i686-darwin11.4.2]

1.8.7 の bug fix は終了しています。

http://www.ruby-lang.org/ja/news/2011/10/07/plans-for-1-8-7/

#4 Updated by Akinori MUSHA over 1 year ago

ruby18には入れておきます。(r36546)

Also available in: Atom PDF