Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 14069 - modf glibc function broken with -march=pentium4 -O3
Summary: modf glibc function broken with -march=pentium4 -O3
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Martin Schlemmer (RETIRED)
: 18284 (view as bug list)
Depends on:
Blocks: 18565
  Show dependency tree
Reported: 2003-01-16 18:34 UTC by Zach Welch (RETIRED)
Modified: 2003-07-26 12:38 UTC (History)
4 users (show)

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


Note You need to log in before you can comment on or make changes to this bug.
Description Zach Welch (RETIRED) gentoo-dev 2003-01-16 18:34:01 UTC
Here's a simple test case:

#include <stdio.h>
#include <math.h>

int main(int argc, char *argv[]) {
        double x = 17.12385, ix, rx;
        rx = modf(x,&ix);
        printf("modf(%lf): ix=%lf, rx=%lf\n",x,ix,rx);
        return 0;

On my PPC, Athlon-XP, Athlon, and 3s, i get the expected:

modf(17.123850): ix=17.000000, rx=0.123850

On the P4 bootstrapped with CLAGS="-march=pentium4 -O3 -pipe", i get:

modf(17.123850): ix=-0.000000, rx=17.123850

which causes all sorts of fun whenever that call is used.

Per drobbins suggestion, I am rebuilding glibc with the following cmd:

CFLAGS="-march=686 -O3 -pipe" emerge glibc

If this does not fix the problem, I will report back here. :)
Comment 1 Zach Welch (RETIRED) gentoo-dev 2003-01-16 21:05:52 UTC
missing details: glibc-2.3.1-r2, gcc-3.2.1-r6, binutils-

rebuiding with -march=i686 fixes the problem
Comment 2 Martin Schlemmer (RETIRED) gentoo-dev 2003-01-16 22:41:17 UTC
Known issue.  -march=pentium3 works as well ...
Comment 3 SpanKY gentoo-dev 2003-01-17 20:16:12 UTC
is there a URL we can refer to ?
Comment 4 Martin Schlemmer (RETIRED) gentoo-dev 2003-01-17 23:04:09 UTC
Personal testing.  I guess I could replace-flags "pentium4" "pentium3" ?
Comment 5 SpanKY gentoo-dev 2003-01-17 23:23:26 UTC
does the glibc ebuild come with a built in test for this ?
if not, a simple program would not be hard to develop ... (we got one already)

that way the concern that the flag replacement may be forgotten when gcc is
fixed will be taken care of ...
Comment 6 Martin Schlemmer (RETIRED) gentoo-dev 2003-01-18 00:58:47 UTC
True.  Currently a -march=pentium3 -O2 -pipe compiled glibc-2.3.1 just fail
over here during 'make check' on the atime test, but that is expected.  If
you can develop a test that catches all of these sure, but I can only see
that we will have to keep on testing with new gcc releases ....
Comment 7 Martin Schlemmer (RETIRED) gentoo-dev 2003-02-01 00:49:40 UTC
Tried with gcc-3.2.2 snapshot, but its still not fixed.
Comment 8 Zach Welch (RETIRED) gentoo-dev 2003-03-08 01:47:33 UTC
okay, latest information:  
glibc-2.3.2 is still broken with -march=pentium4, gcc-3.2.2 
Comment 9 Martin Schlemmer (RETIRED) gentoo-dev 2003-03-30 14:18:03 UTC
*** Bug 18284 has been marked as a duplicate of this bug. ***
Comment 10 Mikkel Schubert 2003-04-11 10:41:37 UTC
Another way to avoid this rather than changing to '-march=pentium3' or 
'-march=i686' is to add the '-mno-sse2' flag. However you'll also have to add it to 
the list of allowed flags in '/usr/portage/eclass/flag-o-matic.eclass' since glibc uses 
the strip-flags function. And the changes you make to the flag-o-matic eclass gets 
reset every time you do an 'emerge sync'. =/ 
Comment 11 SpanKY gentoo-dev 2003-07-26 12:38:01 UTC
another update ... gcc-3.2.3 fixes this bug