[Issue 7734] New: Wrong comparison of float return value from opEquals

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 19 10:57:07 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7734

           Summary: Wrong comparison of float return value from opEquals
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: simen.kjaras at gmail.com


--- Comment #0 from Simen Kjaeraas <simen.kjaras at gmail.com> 2012-03-19 10:57:24 PDT ---
struct Foo {
    float opEquals(int other) {
        return 0.0;
    }
}

void main( ) {
    assert( Foo() != 3 );
}

The above code generates this assembly:

fldz
fucompp
fnstsw      ax  
sahf
je          D main+25h
mov         eax,0Ah  
call        main at __assert

It seems to assume that FPU status flags will be all 0 when the return value is
0.0, which is simply not true - the C3 flag is 1 when the return value is 0.0.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list