------- Additional Comments From uros at kss-loka dot si  2005-08-26 09:35 
-------
(In reply to comment #3)

> Unfortunatelly, ludcompf() result (the second one) is wrong when -O1 or -O2
> is used. It is correct without optimizations.

This is a problem of infamous i387 precision handling. The error can be found 
in this part of the code:

  ...
  if (u.sf[1] > t) { t = u.sf[1]; n = 1; }
  if (u.sf[2] > t) { t = u.sf[2]; n = 2; }
  if (u.sf[3] > t) { t = u.sf[3]; n = 3; }
  ...

Without optimizations, the values of u.sf[1] and t that are at some moment 
loaded into x87 registers are:
u.sf[1] = 1.000000119...
      t = 0.999999880...

and branch is taken. However, with optimizations, the values are different:

u.sf[1] = 0.999999642...
      t = 0.999999821...

This is a problem of the i387 design and not the problem of gcc. In your case, 
you should use -ffloat-store or -mfpmath=sse.

BTW: At the moment, I have very limited time, so I won't be able to create a 
patch to fix the ICE for some time...

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23570

Reply via email to