On Sun, May 30, 2010 at 9:34 AM, Jarmo Pertman <jarmo.p / gmail.com> wrote:
> i executed make test and it seems that some of the tests are also
> failing:
> jarmo@jarmo-laptop:~/Downloads/ruby-1.8.6-p399$ make test
> 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
>
>
> # test.rb
> 1172 test_ok(2.6.floor == 2)
> 1173 test_ok((-2.6).floor == -3)
> 1174 test_ok(2.6.ceil == 3)
> 1175 test_ok((-2.6).ceil == -2)
> 1176 test_ok(2.6.truncate == 2)
> 1177 test_ok((-2.6).truncate == -2)
> 1178 test_ok(2.6.round == 3)
> 1179 test_ok((-2.4).truncate == -2)
> 1180 test_ok((13.4 % 1 - 0.4).abs < 0.0001)
>
> Is there any special switches or commands i should use while compiling?

As far as I checked, ruby_strtod() in util.c is broken by gcc 4.4's
optimization.

1. disable optimization.

  ./configure
  make
  vi Makefile   # replace -O2 to -O0.
  touch util.c  # update the timestamp to recompile util.c.
  make
  sudo make install

2. use gcc-4.3.

  sudo apt-get install gcc-4.3
  ./configure CC=gcc-4.3
  make
  sudo make install

3. configure with  -fno-strict-aliasing and --enable-pthread.
  (I don't know why it dismisses the problem...)

  ./configure CFLAGS='-g -O2 -fno-strict-aliasing' --enable-pthread
  make
  sudo make install