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

           Summary: alignment of double on x86 linux is incorrect
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: wrong-code
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzi...@digitalmars.com
        ReportedBy: to...@famolsen.dk


See this testcase, DMD fails the second assertion, so it does not match the
companion C compiler (which is gcc on linux) as per spec.

The correct alignment of double is 4.

D CODE:
=======

void main()
{
    Foo f = foo();
    assert(f.i == 42);
    assert(f.d == 2.5);
}

extern(C):
struct Foo
{
    int i;
    double d;
}
Foo foo();


C CODE:
=======

typedef struct
{
    int i;
    double d;
} S;

S foo(void)
{
    S s;
    s.i = 42;
    s.d = 2.5;
    return s;
}


-- 

Reply via email to