[Issue 10071] New: 'real' alignment wrong on OS X 32 bit
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun May 12 13:12:50 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10071
Summary: 'real' alignment wrong on OS X 32 bit
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
--- Comment #0 from David Nadlinger <code at klickverbot.at> 2013-05-12 13:12:50 PDT ---
---
cat > structsize.cpp <<EOF
#include <stdio.h>
#include <stddef.h>
typedef long double real;
struct S {
int a;
real d;
bool e;
};
S s;
int main() {
printf("struct size: %lu\n", sizeof(S));
printf("int offset: %lu\n", offsetof(S, a));
printf("real offset: %lu\n", offsetof(S, d));
printf("bool offset: %lu\n", offsetof(S, e));
return 0;
}
EOF
clang++ -o structsize -m32 structsize.cpp && ./structsize
---
prints
---
struct size: 48
int offset: 0
real offset: 16
bool offset: 32
---
but
---
cat > structsize.d <<EOF
struct S {
int a;
real d;
bool e;
};
pragma(msg, "struct size: ", S.sizeof);
pragma(msg, "int offset: ", S.a.offsetof);
pragma(msg, "real offset: ", S.d.offsetof);
pragma(msg, "bool offset: ", S.e.offsetof);
EOF
dmd -m32 -c structsize.d
---
yields
---
struct size: 32u
int offset: 0u
real offset: 8u
bool offset: 24u
---
--
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