This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

other/5574: "http://ego.uwaterloo.ca/SpamGate?ip=216.94.64Off by two error produced by gcc -o test sqr.c -lm



>Number:         5574
>Category:       other
>Synopsis:       "http://ego.uwaterloo.ca/SpamGate?ip=216.94.64Off by two error produced by gcc -o test sqr.c -lm
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 01 11:16:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     murph@winface.com
>Release:        Most gcc 2.9X
>Organization:
>Environment:
Most Linux on Intel systems.
>Description:
The program:
#include stdio.h
#include math.h;
main()
{
    register i;
    double f=0.0; 
    double sqrt();

    for(i=0;i<=1000000000;i++)
    {
        f+=sqrt( (double) i);
    }
    printf("Finished %20.14f\n",f);
}
compiled on linux as:
gcc -o test sqr.c -lm
typically produces:
21081851083598.38281250000000
but compiling as:
gcc -march=i686 -O3 -lm -o test sqr.c
yeilds:  21081851083600.38281250000000
which is closer to the right answer by exactly 2.0.

See: http://www.winface.com/sqrc_results.html for more info.
>How-To-Repeat:
See: http://www.winface.com/sqrc_results.html for more info.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]