lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Infinite loop with GCC 4.3


From: Karl Hammar
Subject: Re: Infinite loop with GCC 4.3
Date: Tue, 27 May 2008 16:11:30 +0200 (CEST)

David:
> "Han-Wen Nienhuys" <address@hidden> writes:
> 
> > 2008/5/26 Karl Hammar <address@hidden>:
> >>> comment #60 sounds promising too. We'd have to have a small bit of
> >>> system dependent code, but it is localized, so I can live with it.
> >>
> >> David Monniaux discusses this problem on page 15-17 of [1].
> >>
> >> His recommondation is to skip using the x87 fpu and use the sse fpu
> >> instead. For this you don't need to add any code to the progran, but you
> >> have the problem of not supporting x86 cpus without sse fpu, and you
> >> have to specify target architecture.
> >
> > People that know what machine they are running on could do this or are
> > running Gentoo could do this,  but I think that for the x87 hack is
> > less of a support headache.

True.

> Would it help to use the following option when compiling?

No.

> `-ffloat-store'
>      Do not store floating point variables in registers, and inhibit
>      other options that might change whether a floating point value is
>      taken from a register or memory.
> 
>      This option prevents undesirable excess precision on machines such
>      as the 68000 where the floating registers (of the 68881) keep more
>      precision than a `double' is supposed to have.  Similarly for the
>      x86 architecture.  For most programs, the excess precision does
>      only good, but a few programs rely on the precise definition of
>      IEEE floating point.  Use `-ffloat-store' for such programs, after
>      modifying them to store all pertinent intermediate computations
>      into variables.
> 
> I mean, the last sentence sounds like a real pain, too.  But maybe it is
> not necessary?

(Above is from gcc doc?)
You take a performance hit with -fflot-store since you are always 
pushing variable values out to memory.

Also, citing [1] p.16,

  ...
  rounding problem (3.1.2). In addition, the -ffloat-store option is difficult
  to use, because it only affects program variables and not temporaries: to ap-
  proximate strict IEEE-754 behaviour, the programmer would have to rewrite
  all program formulae to store temporaries in variables. This does not seem to
  be reasonable for human-written code, but may be possible with automatically
  ...

Now IEEE-754 behavior is not required, the problem is the conversion 
between c's double and x87 registers. It's like you sprinkle your code 
with random roudings of values.

Regards,
/Karl

[1] 
http://hal.archives-ouvertes.fr/docs/00/28/14/29/PDF/floating-point-article.pdf






reply via email to

[Prev in Thread] Current Thread [Next in Thread]