[Issue 291] New: assertion

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 17 00:46:40 PDT 2006


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

           Summary: assertion
           Product: D
           Version: 0.164
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: lio at lunesu.com


void main()
{
        real a;
//      printf("%Lf",a);        // prints "nan"
        assert(a==0.0);         // unexpected PASS!
}

DMD v0.164; assertion correctly fails for double and float, but passes for real
(really). Uncommenting the printf does not change the behavior. Compiled with
-debug -g:

image00400000!_Dmain:
00402010 c80c0000         enter   0xc,0x0
00402014 db2d80004100     fld     tbyte ptr [000000000081209a]
0040201a db7df4           fstp    tbyte ptr [rbp-0xc]
0040201d db6df4           fld     tbyte ptr [rbp-0xc]
00402020 d9ee             fldz
00402022 dae9             fucompp
00402024 dfe0             fstsw
00402026 9e               sahf
00402027 740a jz image00400000!_Dmain+0x23 (00402033)
00402029 b805000000       mov     eax,0x5
0040202e e805000000 call image00400000!assert_1t (00402038)
00402033 31c0             xor     eax,eax
00402035 c9               leave
00402036 c3               ret

The following code is generated when using "double" instead of "real". The
assertion correctly fails.

image00400000!_Dmain:
00402010 c8080000 enter  0x8,0x0
00402014 dd0580004100 fld qword ptr [image00400000!_xt_z+0x10 (00410080)]
0040201a dd5df8  fstp    qword ptr [ebp-0x8]
0040201d 8b45fc  mov     eax,[ebp-0x4]
00402020 01c0    add     eax,eax
00402022 0b45f8  or      eax,[ebp-0x8]
00402025 740a    jz    image00400000!_Dmain+0x21 (00402031)
00402027 b805000000 mov  eax,0x5
0040202c e807000000 call image00400000!assert_1t (00402038)
00402031 31c0    xor     eax,eax
00402033 c9      leave
00402034 c3      ret


-- 




More information about the Digitalmars-d-bugs mailing list