Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 12213 - glibc-2.3.1: fcvt(), ecvt() bug
Summary: glibc-2.3.1: fcvt(), ecvt() bug
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-15 15:18 UTC by Sam Yates
Modified: 2003-02-04 19:42 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Test code demonstrating fcvt() bug (b.c,611 bytes, text/plain)
2002-12-15 15:21 UTC, Sam Yates
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Yates 2002-12-15 15:18:05 UTC
fcvt() should write into its buffer the digits of the supplied double,
without sign or decimal points. A bug causes fcvt() to misinterpret
some doubles as being negative, and in the confusion makes a mess of
its output.

Will attach sample code.

Looking at the glibc-2.3.1 source, there's nothing obvious! It looks
as though signbit() is sometimes returning the wrong result in
misc/efgcvt_r.c:fcvt_r(). However signbit() called in the sample code
produces the expected results.

This bug is causing cdrecord,mkisofs and friends in cdrtools
using libschily to present bogus %ages in their output, as libschily
provides its own fprintf() which uses fcvt() to print floating point
numbers.

From /etc/make.conf:
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium4 -O3 -pipe"
Comment 1 Seemant Kulleen (RETIRED) gentoo-dev 2002-12-15 15:19:50 UTC
what happens if you compile with -march=pentium3 ?

from all accounts, the "-march=pentium4" optimisation causes all sorts of
brokenness in all sorts of places.
Comment 2 Sam Yates 2002-12-15 15:21:03 UTC
Created attachment 6528 [details]
Test code demonstrating fcvt() bug

Compile with gcc -std=gnu99
Comment 3 Sam Yates 2002-12-15 15:24:06 UTC
IIRC, glibc-2.3.1 is compiled with all the CFLAGS stripped of
anything offensive like -march=pentium4 ...

I could rebuild glibc without that in the make.conf, but it's
a lot of trouble :)

'strip-flags' in the glibc-2.3.1 ebuild does strip out -march=pentium4,
doesn't it?

The sample code is compiled without optimizations of any sort though.
Comment 4 Sam Yates 2002-12-15 15:38:18 UTC
Just learnt that strip-flags() left -march alone ...
time for some rebuilding!

Hopefully it's just a pentium4 optimization bug in GCC.
Will update with results.
Comment 5 Sam Yates 2002-12-15 16:06:56 UTC
Ayup! It was march=pentium4 giving me grief. Thanks for the tip!
Rebuilt glibc with march=pentium3 -O3, and now everything is happy again.
Comment 6 Martin Schlemmer (RETIRED) gentoo-dev 2002-12-15 17:12:54 UTC
Ditto, got a pentium4 myself, but compile with -march=pentium3 -O2 -pipe until
the gcc guys get the pentium4 optimizations sorted.