Something broke ruby floats

Noticed this after rebuilding ruby (with configure args
–disable-pthread --enable-shared):

~/src/ruby> RUBYOPT=’’ ./ruby -e ‘x=0.123; puts x’
123.0
~/src/ruby> ldd ./ruby
linux-gate.so.1 => (0x00b0e000)
libruby.so.1.8 => /usr/local/lib/libruby.so.1.8 (0x00236000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0x00132000)
libcrypt.so.1 => /lib/tls/i686/cmov/libcrypt.so.1 (0x007b8000)
libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0x00d63000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x00394000)
/lib/ld-linux.so.2 (0x0067e000)
~/src/ruby> ./ruby -v
ruby 1.8.6 (2008-08-11 patchlevel 287) [i686-linux]

(same after make install)

Any ideas what broke? I’ve never seen anything like this before, and
I’ve been using p287 on several systems for months (at least). This is
on ubuntu karmic.

Further info:

~/src/ruby> make check
not ok float 1 – ./sample/test.rb:1172
not ok float 2 – ./sample/test.rb:1173
not ok float 3 – ./sample/test.rb:1174
not ok float 4 – ./sample/test.rb:1175
not ok float 5 – ./sample/test.rb:1176
not ok float 6 – ./sample/test.rb:1177
not ok float 7 – ./sample/test.rb:1178
not ok float 8 – ./sample/test.rb:1179
not ok float 9 – ./sample/test.rb:1180
test failed
make: *** [test] Error 1

CC’ing ruby-core@

~/src/ruby> RUBYOPT=’’ ./ruby -e ‘x=0.123; puts x’
123.0

on Ubuntu 8.04.3 LTS I don’t seem to get it.

$ ./ruby -ve ‘x=0.123; puts x’
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux]
0.123

If that is any help.
-r

Roger P. wrote:

-r
That’s consistent with my experience through ubuntu 9.04. Also, the
ubuntu-packaged ruby (which is 1.8.7) doesn’t have the problem in 9.10.

It appears to be a gcc version issue. With 4.4.1, floats break; with
4.3.4, all is ok.

Maybe this is related to the date parsing issue with 4.4.1 (when
building the syntax gem).

It sounds like gcc 4.4.2 fixes some “serious bugs” in 4.4.1 [1], but the
ubuntu packagers are reluctant to upgrade.[2] Fortunately, gcc-4.3 is
easy to apt-get.

[1] http://freesoftnews.com/archives/18347

[2] Question #91976 “need gcc-4.4.2 for certain ruby libs” : Questions : gcc-4.4 package : Ubuntu

It sounds like gcc 4.4.2 fixes some “serious bugs” in 4.4.1 [1], but the
ubuntu packagers are reluctant to upgrade.[2] Fortunately, gcc-4.3 is easy
to apt-get.

Does 4.4.2 fix these floating point weirdnesses then?
-r

Ryan D. wrote:

CC’ing ruby-core@

Thanks.

Brief update: building with gcc-4.3 seems to fix the issue, and make check passes, except for one test in SOAP.