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

--- Comment #0 from Simen Kjaeraas <> 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:

fnstsw      ax  
je          D main+25h
mov         eax,0Ah  
call        main@__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:
------- You are receiving this mail because: -------

Reply via email to