Hi,

Attached is a small demo program (demo.c).

With 32-bit mingw compilers (both mingw.org's 4.5.2 and mingw64's 4.6.3) the output of that program differs, depending upon whether I build it with -ffloat-store or not.
I've no problem with that - I think I understand what's going on.
To get the output I desire I build *with* -ffloat-store.

When I switch to 64-bit mingw64 compilers (I've tried both 4.6.3 and 4.7.0) I get the desired output *without* having to invoke -ffloat-store.
And if I do invoke -ffloat-store, I still get the same output.

Why the different behaviour with the 64-bit compilers ?

And a second question:
Is -fno-float-store a valid option ?
I can find no documentation for it - yet using it on the command line does not produce the "unrecognized command line option" error that I would expect from an invalid option.

Cheers,
Rob
#include <stdio.h>

#define N 11
double x[N] = { 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 };
int    a[N], b[N], diff[N];
char  *success_message = "ok 1 - lists are equal";
char  *failure_message = "not ok 1 - lists are equal";

static void
print( int *v, char *title )
{
        int i;
        printf( "%s = [", title );
        for( i = 0; i < N; i++ ) printf( "%2d ", v[i] );
        printf( "] \n" );
}

static int
ok( int *v )
{
        int i;
        for( i = 0; i < N; i++ ) if( v[i] ) return 0;
        return 1;
}

double divide1( double a, double b ) { return a/b; }
int    divide2( double a, double b ) { return a/b; }
int    convert( double a )           { return a; }

int
main( int argc, char **argv )
{
        int i;
        char *msg;
        printf( "1..1\n" );
        for( i = 0; i < N; i++ ) a[i] = convert( divide1( x[i], .1 ) );
        for( i = 0; i < N; i++ ) b[i] = divide2( x[i], .1 );
        for( i = 0; i < N; i++ ) diff[i] = a[i] - b[i];
        print( a,    "#     a" );
        print( b,    "#     b" );
        print( diff, "# a - b" );
        msg = ok( diff ) ? success_message : failure_message;
        printf( "%s\n", msg );
        return 0;
}
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to