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: John Mandereau
Subject: Re: Infinite loop with GCC 4.3
Date: Mon, 26 May 2008 23:33:35 +0200

On 2008/05/26, Han-Wen Nienhuys wrote:
> 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.

I followed suggestion from this comment #60, including #include
<fpu_control.h> and adding the two lines

  fpu_control_t fpu_control = 0x027f ;
  _FPU_SETCW(fpu_control);

at the beginning of main().  This fixes the bug for me with GCC 4.3.0 on
Joe's example skyline2.cc (I didn't bother trying other GCC versions,
now I know this is not really a bug in GCC but a result of "strange"
behavior of 387 FPU).  I'll test this for building Lily later.

This sounds the most reasonable alternative, as LilyPond may have to run
on "old" x86 CPUs without SSE2 instructions set, i.e. older than Pentium
4 or compatible.


For builders compiling for their own machine (like me), an alternative
to adding this specific code is suggested in comment #109: using
-mfpmath=sse *and* one of the following flags:
* -msse2
* -march=pentium4
* maybe athlon-4, athlon-xp and athlon-mp work for -march (I can test on
an Athlon XP, but not right now); I don't know if -m3dnow could also
replace -msse2 on Athlon CPUs.

These flags work well around the inaccurate rounding or truncating bug
with GCC 4.3.0, on both Joe's example and LilyPond from master branch.
Note that -msse or -march=pentium3 are not enough to avoid the bug.

Would it be possible to enable the fpu_control fix code by default
in ./configure script on x86, with a command-line option to disable this
for people who can use and prefer '-march=pentium4 -mfpmath=sse'[*]?

[*] these flags seem to speed up Lily running a little, I'll come with
precise statistics later.

Cheers,
John





reply via email to

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