http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57722

            Bug ID: 57722
           Summary: Floating point problems when building with no-sse and
                    no-mmx
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: translation
          Assignee: unassigned at gcc dot gnu.org
          Reporter: boris at dolgov dot name

Hi!

I want to prevent gcc from generating code with xmm registers on 64bit system.
I use -mno-sse and -mno-mmx flags to achieve this.
But when the program is compiled using these flags, some strange problems
appear:
$ cat vect.c
#include <stdio.h>
int main()
{
        double x1, y1, x2, y2, r0;
        scanf("%lf%lf%lf%lf", &x1, &y1, &x2, &y2);
        r0 = x1*y2 - x2*y1;
        printf("%.10lf %d\n", r0, (int)(r0 == 0));
    return 0;
}
$ gcc -o vect0 vect.c -Wall -Wextra
$ gcc -mno-mmx -mno-sse -o vect1 vect.c -Wall -Wextra
$ echo "1 0 0 1" | ./vect0
1.0000000000 0
$ echo "1 0 0 1" | ./vect1
0.0000000000 0
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.7.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure
Thread model: posix
gcc version 4.7.2 (GCC)

What is the problem?

Reply via email to