[Issue 9239] New: x86_64 ABI: 3 byte structs are never enregistered

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 28 19:26:30 PST 2012


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

           Summary: x86_64 ABI: 3 byte structs are never enregistered
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: code at klickverbot.at
            Blocks: 5570


--- Comment #0 from David Nadlinger <code at klickverbot.at> 2012-12-28 19:26:29 PST ---
The following example shows the problem:

---
struct RGB { char r, g, b; };
void foo(RGB c);
void bar() {
    RGB c;
    c.r = 1;
    c.g = 2;
    c.b = 3;
    foo(c);
}
---

Compiled with Clang:

---
0000000000000000 <_Z3barv>:
   0:   bf 01 02 03 00          mov    edi,0x30201
   5:   e9 00 00 00 00          jmp    a <_Z3barv+0xa>
---

Compiled with DMD (Git master):
---
0000000000000000 <_D4test3barFZv>:
   0:   55                      push   rbp
   1:   48 8b ec                mov    rbp,rsp
   4:   48 83 ec 10             sub    rsp,0x10
   8:   48 be 00 00 00 00 00    movabs rsi,0x0
   f:   00 00 00 
  12:   48 8d 7d f8             lea    rdi,[rbp-0x8]
  16:   a4                      movs   BYTE PTR es:[rdi],BYTE PTR ds:[rsi]
  17:   a4                      movs   BYTE PTR es:[rdi],BYTE PTR ds:[rsi]
  18:   a4                      movs   BYTE PTR es:[rdi],BYTE PTR ds:[rsi]
  19:   c6 45 f8 01             mov    BYTE PTR [rbp-0x8],0x1
  1d:   c6 45 f9 02             mov    BYTE PTR [rbp-0x7],0x2
  21:   c6 45 fa 03             mov    BYTE PTR [rbp-0x6],0x3
  25:   48 83 ec 08             sub    rsp,0x8
  29:   ff 75 f8                push   QWORD PTR [rbp-0x8]
  2c:   e8 00 00 00 00          call   31 <_D4test3barFZv+0x31>
  31:   48 83 c4 10             add    rsp,0x10
  35:   48 8b e5                mov    rsp,rbp
  38:   5d                      pop    rbp
  39:   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