From: "H.Yamamoto" Date: 2006-02-04T17:20:00+09:00 Subject: Re: [ ruby-Bugs-3438 ] (2**32).to_s(2) fails with exception on Redhat Opteron with gcc 3.4.3 compile Hello. >>Assigned to: Nobody (None) >>Summary: (2**32).to_s(2) fails with exception on Redhat Opteron with gcc >3.4.3 >>compile >> >>Initial Comment: >>Sorry I don't have the complete exception to provide here. >>The computer is at work and not connected to the Internet. >> >>The Summary pretty much says it all. >> >>(0..64).each {|i| print i,"\t",(2**i).to_s(2),"\n" rescue next} > > I get same failure with solaris 10, sunstudio 11 compiler. My ruby > is 64 bit as well. >> >>If I was a bettin' man, I'd bet that you'd find some 64-bit integer >>somewhere being incorrectly cast or squeezed into a 32-bit integer. >>When Bignum takes over, all the conversions work properly. > > I will not bet against you. There is probably some 'long' >problem. > >> >>This problem also makes me wonder what other surprises are waiting >>for 64-bit platform users. > > At least sun studio 11 spits many warnings about interger overlfows > and other messages. I can post them here. I have fixed this problem on CVS. Please try latest ruby_1_8 branch. # I think we should clarify the type of interger. rb_int2big is misleading. # (this actually deals with `long` not `int`) # # And maybe this should be fixed at same time? # http://rubyforge.org/tracker/index.php?func=detail&aid=1823&group_id=426&atid=1698