[Issue 5188] New: alias this and compare expression generates wrong code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 8 06:18:14 PST 2010


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

           Summary: alias this and compare expression generates wrong code
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2010-11-08 06:17:11 PST ---
// bug.d
struct S
{
    int v = 10;
    alias v this;
}
void main()
{
    S s;
    assert(s <= 20);    // fail!?
}

// use ddbg 0.11 beta
bug.d:6 void main()
00402010: c8040000                enter 0x4, 0x0
bug.d:8         S s;
00402014: a180504100              mov eax, [0x415080]
00402019: 8945fc                  mov [ebp-0x4], eax
bug.d:9         assert(s <= 20);
0040201c: 837dfc14                cmp dword [ebp-0x4], 0x14
00402020: b901000000              mov ecx, 0x1
00402025: 7e02                    jle 0x402029  _Dmain bug.d:9  // jump to
0x402029
00402027: 31c9                    xor ecx, ecx                  // not run
00402029: 31d2                    xor edx, edx                  // edx = 0
0040202b: 3bca                    cmp ecx, edx                  // ecx==1,
edx==0
0040202d: 7e0a                    jle 0x402039  _Dmain bug.d:9  // fail
0040202f: b809000000              mov eax, 0x9                  // eax = 9
00402034: e807000000              call 0x402040 bug.__assert    // assert!
00402039: 31c0                    xor eax, eax
bug.d:10 }
0040203b: c9                      leave
0040203c: c3                      ret

-- 
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