[Issue 11817] New: Structs with void initialized fields get initialized anyway

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 25 13:38:57 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11817

           Summary: Structs with void initialized fields get initialized
                    anyway
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bugzilla at digitalmars.com


--- Comment #0 from Walter Bright <bugzilla at digitalmars.com> 2013-12-25 13:38:54 PST ---
----- Code -----
struct S {
    int a;
    ubyte[100] b = void;
}

void test() {
    S s;
    s.a = 3;
}
---------------

The output:

        enter   068h,0
        push    ESI
        push    EDI
        mov     ESI,offset FLAT:_D4foo21S6__initZ
        lea     EDI,-068h[EBP]
        mov     ECX,01Ah
        rep
        movsd
        mov     dword ptr -068h[EBP],3
        pop     EDI
        pop     ESI
        leave
        ret

I.e. the field s.b is initialized. While not pedantically a bug, this
substantially interferes with performance tuning.

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


More information about the Digitalmars-d-bugs mailing list