[Bug 236] New: Empty structs not copied correctly

via D.gnu d.gnu at puremagic.com
Mon Aug 8 12:18:22 PDT 2016


http://bugzilla.gdcproject.org/show_bug.cgi?id=236

            Bug ID: 236
           Summary: Empty structs not copied correctly
           Product: GDC
           Version: development
          Hardware: ARM
                OS: All
            Status: NEW
          Severity: minor
          Priority: Normal
         Component: gdc
          Assignee: ibuclaw at gdcproject.org
          Reporter: johannespfau at gmail.com

There's a failing unittest on ARM in rt.aaA. The test uses a struct without any
non-fields as an index for the AA. The hashing function for an empty struct
always hashes exactly one byte. It seems this data is not always copied when
assigning an empty struct. It probably requires the values to be passed on the
stack.

void foo()
{
    int a;
}

struct NoField
{
    //ubyte f;
}

void main()
{
    foo();
    NoField[2] fields = void;
    fields[0] = NoField();
    import core.stdc.stdio;
    printf("%d\n", *(cast(ubyte*)&fields[0]));
}

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the D.gnu mailing list